From 61fb78d7ca96e8df6edce6436c16a458fa6062b7 Mon Sep 17 00:00:00 2001 From: Meni Yakove Date: Wed, 26 Jul 2023 18:13:33 +0300 Subject: [PATCH] Remove openshift python module dependencies, use kubernetes --- poetry.lock | 64 ++++++++++++++++++++++++++++++++++++++++- pyproject.toml | 5 ++++ tests/test_resources.py | 2 +- tox.ini | 37 ++++++++++++------------ 4 files changed, 88 insertions(+), 20 deletions(-) diff --git a/poetry.lock b/poetry.lock index c89a1dd2c4..01e33a2245 100644 --- a/poetry.lock +++ b/poetry.lock @@ -491,6 +491,20 @@ files = [ [package.dependencies] packaging = ">=20.9" +[[package]] +name = "exceptiongroup" +version = "1.1.2" +description = "Backport of PEP 654 (exception groups)" +optional = false +python-versions = ">=3.7" +files = [ + {file = "exceptiongroup-1.1.2-py3-none-any.whl", hash = "sha256:e346e69d186172ca7cf029c8c1d16235aa0e04035e5750b4b95039e65204328f"}, + {file = "exceptiongroup-1.1.2.tar.gz", hash = "sha256:12c3e887d6485d16943a309616de20ae5582633e0a2eda17f4e10fd61c1e8af5"}, +] + +[package.extras] +test = ["pytest (>=6)"] + [[package]] name = "executing" version = "1.2.0" @@ -613,6 +627,17 @@ zipp = {version = ">=3.1.0", markers = "python_version < \"3.10\""} docs = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-lint"] testing = ["pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=2.2)", "pytest-mypy (>=0.9.1)", "pytest-ruff"] +[[package]] +name = "iniconfig" +version = "2.0.0" +description = "brain-dead simple config-ini parsing" +optional = false +python-versions = ">=3.7" +files = [ + {file = "iniconfig-2.0.0-py3-none-any.whl", hash = "sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374"}, + {file = "iniconfig-2.0.0.tar.gz", hash = "sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3"}, +] + [[package]] name = "installer" version = "0.7.0" @@ -1110,6 +1135,21 @@ files = [ docs = ["furo (>=2023.5.20)", "proselint (>=0.13)", "sphinx (>=7.0.1)", "sphinx-autodoc-typehints (>=1.23,!=1.23.4)"] test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=7.3.1)", "pytest-cov (>=4.1)", "pytest-mock (>=3.10)"] +[[package]] +name = "pluggy" +version = "1.2.0" +description = "plugin and hook calling mechanisms for python" +optional = false +python-versions = ">=3.7" +files = [ + {file = "pluggy-1.2.0-py3-none-any.whl", hash = "sha256:c2fd55a7d7a3863cba1a013e4e2414658b1d07b6bc57b3919e0c63c9abb99849"}, + {file = "pluggy-1.2.0.tar.gz", hash = "sha256:d12f0c4b579b15f5e054301bb226ee85eeeba08ffec228092f8defbaa3a4c4b3"}, +] + +[package.extras] +dev = ["pre-commit", "tox"] +testing = ["pytest", "pytest-benchmark"] + [[package]] name = "poetry" version = "1.5.1" @@ -1300,6 +1340,28 @@ files = [ [package.dependencies] tomli = {version = ">=1.1.0", markers = "python_version < \"3.11\""} +[[package]] +name = "pytest" +version = "7.4.0" +description = "pytest: simple powerful testing with Python" +optional = false +python-versions = ">=3.7" +files = [ + {file = "pytest-7.4.0-py3-none-any.whl", hash = "sha256:78bf16451a2eb8c7a2ea98e32dc119fd2aa758f1d5d66dbf0a59d69a3969df32"}, + {file = "pytest-7.4.0.tar.gz", hash = "sha256:b4bf8c45bd59934ed84001ad51e11b4ee40d40a1229d2c79f9c592b0a3f6bd8a"}, +] + +[package.dependencies] +colorama = {version = "*", markers = "sys_platform == \"win32\""} +exceptiongroup = {version = ">=1.0.0rc8", markers = "python_version < \"3.11\""} +iniconfig = "*" +packaging = "*" +pluggy = ">=0.12,<2.0" +tomli = {version = ">=1.0.0", markers = "python_version < \"3.11\""} + +[package.extras] +testing = ["argcomplete", "attrs (>=19.2.0)", "hypothesis (>=3.56)", "mock", "nose", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"] + [[package]] name = "python-benedict" version = "0.32.0" @@ -2048,4 +2110,4 @@ testing = ["big-O", "jaraco.functools", "jaraco.itertools", "more-itertools", "p [metadata] lock-version = "2.0" python-versions = "^3.8" -content-hash = "1d8fb7ba26ac8a154dc34eae82defc562c7057b99d3027cc58850020a1614ca0" +content-hash = "106737b5f75bdb59c7ccaf6f5e2a8c6e0376fbfbfc4cc1e42fbeefc09f6bc19c" diff --git a/pyproject.toml b/pyproject.toml index 8cbe99f61d..303e7d3c4a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,6 +39,11 @@ Download = "https://pypi.org/project/openshift-python-wrapper/" [tool.poetry.group.dev.dependencies] ipdb = "^0.13.13" + +[tool.poetry.group.tests.dependencies] +pytest = "^7.4.0" +requests = "^2.31.0" + [tool.poetry-dynamic-versioning.substitution] files = ["VERSION"] diff --git a/tests/test_resources.py b/tests/test_resources.py index 57d17c1ae1..721318ba68 100644 --- a/tests/test_resources.py +++ b/tests/test_resources.py @@ -1,6 +1,6 @@ import kubernetes import pytest -from openshift.dynamic import DynamicClient +from kubernetes.dynamic import DynamicClient from ocp_resources.namespace import Namespace from ocp_resources.pod import Pod diff --git a/tox.ini b/tox.ini index 888f3349fc..a6c29f572b 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py{38,39,310,311}, unittests, validate-resources +envlist = py{38,39,310,311}, unittests, validate-resources, tests skipsdist = True [flake8] @@ -16,24 +16,25 @@ setenv = PYTHONPATH = {toxinidir} passenv = KUBECONFIG -deps = - pytest commands = - pip install pip -U - pip install . - pip install jinja2 PyYaml - pytest -o log_cli=true tests/test_resources.py -k 'not kubevirt' + sh -c 'curl -sSL https://install.python-poetry.org | python3 -' + poetry install + poetry run pytest -o log_cli=true tests/test_resources.py -k 'not kubevirt' +allowlist_externals = + sh + poetry [testenv:unittests] basepython = python3 setenv = PYTHONPATH = {toxinidir} -deps = - pytest commands = - pip install pip -U - pip install . - pytest -o log_cli=true tests/unittests + sh -c 'curl -sSL https://install.python-poetry.org | python3 -' + poetry install + poetry run pytest -o log_cli=true tests/unittests +allowlist_externals = + sh + poetry [testenv:validate-resources] basepython = python3 @@ -41,10 +42,10 @@ setenv = PYTHONPATH = {toxinidir} passenv = KUBECONFIG -deps = - pytest - requests commands = - pip install pip -U - pip install . - pytest tests/test_validate_resources.py + sh -c 'curl -sSL https://install.python-poetry.org | python3 -' + poetry install + poetry run pytest tests/test_validate_resources.py +allowlist_externals = + sh + poetry