From f68869a7934fd054fa0f241c8045d86d879db1ef Mon Sep 17 00:00:00 2001 From: Cédric Ollivier Date: Tue, 14 Mar 2023 11:05:18 +0100 Subject: Replace nose by pytest MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: If4b8feac021fb2fe5994a6b6bd1e36d302cb8b88 Signed-off-by: Cédric Ollivier --- requirements.txt | 1 + test-requirements.txt | 4 +++- tox.ini | 27 ++++++++++----------------- upper-constraints.txt | 4 +++- 4 files changed, 17 insertions(+), 19 deletions(-) diff --git a/requirements.txt b/requirements.txt index cb74132e2..23fc58e52 100644 --- a/requirements.txt +++ b/requirements.txt @@ -19,3 +19,4 @@ ruamel.yaml.jinja2 # MIT tempest # Apache-2.0 rally rally-openstack +munch # MIT diff --git a/test-requirements.txt b/test-requirements.txt index e3cf977e8..a552f60f2 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -3,7 +3,9 @@ # process, which may cause wedges in the gate later. coverage!=4.4 # Apache-2.0 mock!=4.0.0,!=4.0.1 # BSD -nose # LGPL +pytest # MIT +pytest-html #MPL-2.0 +pytest-cov flake8 # MIT pylint # GPLv2 sphinx!=1.6.6,!=1.6.7,!=2.1.0,!=3.0.0,!=3.4.2 # BSD diff --git a/tox.ini b/tox.ini index 71e8c1b56..b3e514681 100644 --- a/tox.ini +++ b/tox.ini @@ -10,13 +10,12 @@ deps = -r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt install_command = pip install {opts} {packages} -commands = nosetests --with-xunit \ - --with-coverage \ - --cover-tests \ - --cover-package=functest \ - --cover-xml \ - --cover-html \ - functest/tests/unit +commands = + pytest \ + --junit-xml=junit.xml \ + --html=report.html --self-contained-html \ + --cov=xtesting --cov-reset --cov-report html \ + functest/tests/unit [testenv:docs] basepython = python3.10 @@ -41,6 +40,7 @@ basepython = python3.10 commands = pylint \ --ignore-imports=y --min-similarity-lines=15 \ + --generated-members=os.* \ --disable=locally-disabled functest [testenv:yamllint] @@ -57,9 +57,6 @@ files = commands = yamllint -s {[testenv:yamllint]files} -[testenv:py37] -commands = nosetests functest/tests/unit - [testenv:bashate] basepython = python3.10 files = @@ -71,7 +68,6 @@ files = build.sh commands = bashate -e E005,E006,E042,E043 {[testenv:bashate]files} - [testenv:bandit] basepython = python3.10 commands = bandit -r functest -x tests -n 5 -ll -s B601,B602 @@ -82,12 +78,9 @@ dirs = functest/tests/unit/odl functest/tests/unit/openstack/vping functest/tests/unit/openstack/cinder -commands = nosetests --with-coverage --cover-tests \ - --cover-package functest.opnfv_tests.sdn.odl \ - --cover-package functest.opnfv_tests.openstack.vping.vping_ssh \ - --cover-package functest.opnfv_tests.openstack.cinder.cinder_test \ - --cover-package functest.tests.unit \ - --cover-min-percentage 100 {[testenv:cover]dirs} +commands = + pytest --cov=xtesting --cov-reset --cov-report html --cov-fail-under=100 \ + {[testenv:cover]dirs} [testenv:perm] basepython = python3.10 diff --git a/upper-constraints.txt b/upper-constraints.txt index 0df00ed43..bddb3334b 100644 --- a/upper-constraints.txt +++ b/upper-constraints.txt @@ -14,7 +14,9 @@ git+https://opendev.org/openstack/rally-openstack.git#egg=rally-openstack git+https://github.com/xrally/xrally-kubernetes.git#egg=xrally-kubernetes pylint===2.11.1 flake8===4.0.1 -nose===1.3.7 +pytest===7.1.2 +pytest-cov===3.0.0 +pytest-html===3.1.1 ruamel.yaml===0.17.17 sphinxcontrib-spelling===4.3.0 ansible-lint===5.2.1 -- cgit 1.2.3-korg