summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-x.probetests2
-rwxr-xr-x.unittests2
-rw-r--r--.zuul.yaml15
-rw-r--r--CONTRIBUTING.rst4
-rw-r--r--doc/source/development_guidelines.rst2
-rw-r--r--lower-constraints.txt7
-rw-r--r--py2-constraints.txt5
-rw-r--r--py36-constraints.txt3
-rw-r--r--test-requirements.txt7
-rw-r--r--test/probe/test_sharder.py2
-rw-r--r--tools/playbooks/common/install_dependencies.yaml11
-rw-r--r--tools/playbooks/probetests/run.yaml2
-rw-r--r--tox.ini14
13 files changed, 27 insertions, 49 deletions
diff --git a/.probetests b/.probetests
index 4c8d4dd36..9a7aafda6 100755
--- a/.probetests
+++ b/.probetests
@@ -3,7 +3,7 @@
SRC_DIR=$(dirname $(realpath "$0"))
cd ${SRC_DIR}/test/probe
-nosetests --exe $@
+pytest $@
rvalue=$?
cd -
diff --git a/.unittests b/.unittests
index aecedf813..9873b1797 100755
--- a/.unittests
+++ b/.unittests
@@ -3,7 +3,7 @@
TOP_DIR=$(dirname $(realpath "$0"))
cd $TOP_DIR/test/unit
-nosetests --exe --with-coverage --cover-package swift --cover-erase --cover-branches --cover-html --cover-html-dir="$TOP_DIR"/cover $@
+pytest --cov-report=html:"$TOP_DIR"/cover $@
rvalue=$?
rm -f .coverage
cd -
diff --git a/.zuul.yaml b/.zuul.yaml
index 852bb6f24..517aec102 100644
--- a/.zuul.yaml
+++ b/.zuul.yaml
@@ -25,9 +25,6 @@
vars:
tox_envlist: py27
python_version: 2.7
- tox_environment:
- NOSE_COVER_HTML: 1
- NOSE_COVER_HTML_DIR: '{toxinidir}/cover'
post-run: tools/playbooks/common/cover-post.yaml
- job:
@@ -52,9 +49,6 @@
tox_envlist: py36
bindep_profile: test py36
python_version: 3.6
- tox_environment:
- NOSE_COVER_HTML: 1
- NOSE_COVER_HTML_DIR: '{toxinidir}/cover'
post-run: tools/playbooks/common/cover-post.yaml
- job:
@@ -76,9 +70,6 @@
tox_envlist: py37
bindep_profile: test py37
python_version: 3.7
- tox_environment:
- NOSE_COVER_HTML: 1
- NOSE_COVER_HTML_DIR: '{toxinidir}/cover'
post-run: tools/playbooks/common/cover-post.yaml
- job:
@@ -95,9 +86,6 @@
tox_envlist: py38
bindep_profile: test py38
python_version: 3.8
- tox_environment:
- NOSE_COVER_HTML: 1
- NOSE_COVER_HTML_DIR: '{toxinidir}/cover'
post-run: tools/playbooks/common/cover-post.yaml
- job:
@@ -130,9 +118,6 @@
tox_envlist: py39
bindep_profile: test py39
python_version: 3.9
- tox_environment:
- NOSE_COVER_HTML: 1
- NOSE_COVER_HTML_DIR: '{toxinidir}/cover'
post-run: tools/playbooks/common/cover-post.yaml
- job:
diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst
index 746e7bb74..8f5c70d29 100644
--- a/CONTRIBUTING.rst
+++ b/CONTRIBUTING.rst
@@ -145,11 +145,11 @@ Running the tests above against Swift in your development environment
to be both tested and documented and all tests should pass.
If you want to run just a subset of the tests while you are developing,
-you can use nosetests:
+you can use pytest:
.. code-block:: console
- cd test/unit/common/middleware/ && nosetests test_healthcheck.py
+ cd test/unit/common/middleware/ && pytest test_healthcheck.py
To check which parts of your code are being exercised by a test, you can
run tox and then point your browser to swift/cover/index.html:
diff --git a/doc/source/development_guidelines.rst b/doc/source/development_guidelines.rst
index 979a728e0..6fdf7c507 100644
--- a/doc/source/development_guidelines.rst
+++ b/doc/source/development_guidelines.rst
@@ -197,7 +197,7 @@ edited to provide AWS key IDs and secrets. Alternatively, an AWS CLI style
credentials file can be loaded by setting the ``SWIFT_TEST_AWS_CONFIG_FILE``
environment variable, e.g.::
- SWIFT_TEST_AWS_CONFIG_FILE=~/.aws/credentials nosetests ./test/s3api
+ SWIFT_TEST_AWS_CONFIG_FILE=~/.aws/credentials pytest ./test/s3api
.. note::
When using ``SWIFT_TEST_AWS_CONFIG_FILE``, the region defaults to
diff --git a/lower-constraints.txt b/lower-constraints.txt
index 55336388e..47f5027e2 100644
--- a/lower-constraints.txt
+++ b/lower-constraints.txt
@@ -11,7 +11,7 @@ cffi==1.11.5
chardet==3.0.4
cliff==2.11.0
cmd2==0.8.1
-coverage==3.6
+coverage==5.0.4
cryptography==2.0.2
debtcollector==1.19.0
dnspython==1.15.0
@@ -40,9 +40,6 @@ monotonic==1.4
msgpack==0.5.6
netaddr==0.7.19
netifaces==0.8
-nose==1.3.7
-nosehtmloutput==0.0.3
-nosexcover==1.0.10
oslo.config==4.0.0
oslo.i18n==3.20.0
oslo.log==3.22.0
@@ -57,6 +54,8 @@ pykmip==0.7.0
Pygments==2.2.0
pyparsing==2.2.0
pyperclip==1.6.0
+pytest==4.6.11
+pytest-cov==2.12.1
python-keystoneclient==2.0.0
python-mimeparse==1.6.0
python-subunit==1.2.0
diff --git a/py2-constraints.txt b/py2-constraints.txt
index 40a5e5d86..a4209fbfc 100644
--- a/py2-constraints.txt
+++ b/py2-constraints.txt
@@ -8,11 +8,8 @@ alabaster===0.7.12
pbr===5.4.5
oslo.i18n===3.25.1
fixtures===3.0.0
-nose===1.3.7
-nosehtmloutput===0.0.7
sphinxcontrib-websupport===1.1.2
ipaddress===1.0.23
-nosexcover===1.0.11
debtcollector===1.22.0
MarkupSafe===1.1.1
netaddr===0.7.19
@@ -79,3 +76,5 @@ setuptools===44.1.1
pycadf===2.10.0
smmap===3.0.5
PasteDeploy==2.1.1
+pytest==4.6.11
+pytest-cov==2.12.1
diff --git a/py36-constraints.txt b/py36-constraints.txt
index 623746daa..58cdf883e 100644
--- a/py36-constraints.txt
+++ b/py36-constraints.txt
@@ -40,9 +40,6 @@ mock==4.0.3
msgpack==1.0.3
netaddr==0.8.0
netifaces==0.11.0
-nose==1.3.7
-nosehtmloutput==0.0.7
-nosexcover==1.0.11
os-service-types==1.7.0
oslo.cache==2.11.0
oslo.config==8.8.0
diff --git a/test-requirements.txt b/test-requirements.txt
index 7eb48af72..488080ae5 100644
--- a/test-requirements.txt
+++ b/test-requirements.txt
@@ -4,10 +4,9 @@
# Hacking already pins down pep8, pyflakes and flake8
hacking>=2.0,<2.1.0 # Apache-2.0
-coverage>=3.6 # Apache-2.0
-nose>=1.3.7 # LGPL
-nosexcover>=1.0.10 # BSD
-nosehtmloutput>=0.0.3 # Apache-2.0
+coverage>=5.0.4 # Apache-2.0
+pytest>=4.6.11 # MIT
+pytest-cov>=2.12.1 # MIT
stestr>=2.0.0 # Apache-2.0
mock>=2.0 # BSD
python-swiftclient>=3.2.0
diff --git a/test/probe/test_sharder.py b/test/probe/test_sharder.py
index 4382d8314..129f06d35 100644
--- a/test/probe/test_sharder.py
+++ b/test/probe/test_sharder.py
@@ -19,7 +19,7 @@ import subprocess
import unittest
import uuid
-from nose import SkipTest
+from unittest import SkipTest
import six
from six.moves.urllib.parse import quote
diff --git a/tools/playbooks/common/install_dependencies.yaml b/tools/playbooks/common/install_dependencies.yaml
index 6e2693a27..40eecd037 100644
--- a/tools/playbooks/common/install_dependencies.yaml
+++ b/tools/playbooks/common/install_dependencies.yaml
@@ -35,14 +35,17 @@
- name: install python modules with pip
pip: name={{ item }} state=present extra_args='--upgrade'
with_items:
+ # For some reason, pip on py2 isn't smart enough to prevent us
+ # trying to install a too-new mock or attrs??
+ - 'mock<4'
+ - 'attrs<22.1.0'
+ # Order matters; install constrained versions *first*, then unconstrained
- crudini
- eventlet
- - nose
- pyeclib
+ - pytest
+ - pytest-cov
- python-swiftclient
- # For some reason, pip on py2 isn't smart enough to prevent us
- # trying to install a too-new mock??
- - 'mock<4'
- name: install PasteDeploy - CentOS 7
pip: name={{ item }} state=present extra_args='--upgrade'
diff --git a/tools/playbooks/probetests/run.yaml b/tools/playbooks/probetests/run.yaml
index 323b52cb7..e6ea0a21f 100644
--- a/tools/playbooks/probetests/run.yaml
+++ b/tools/playbooks/probetests/run.yaml
@@ -21,6 +21,6 @@
shell:
cmd: |
source ~/.bashrc
- nosetests test/probe/ --with-id || nosetests --failed
+ pytest test/probe/ || pytest --last-failed test/probe/
executable: /bin/bash
chdir: '{{ zuul.project.src_dir }}'
diff --git a/tox.ini b/tox.ini
index 3b7e5f30b..e1a6074af 100644
--- a/tox.ini
+++ b/tox.ini
@@ -3,13 +3,13 @@ envlist = py37,py27,pep8
minversion = 2.3.2
skipsdist = True
+[pytest]
+addopts = --verbose --cov=swift --cov-branch --cov-report=html:cover --cov-report term
+
[testenv]
usedevelop = True
install_command = pip install -U {opts} {packages}
setenv = VIRTUAL_ENV={envdir}
- NOSE_WITH_COVERAGE=1
- NOSE_COVER_BRANCHES=1
- NOSE_COVER_HTML_DIR={toxinidir}/cover
deps =
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/requirements.txt
@@ -17,7 +17,7 @@ deps =
commands =
find {envdir} ( -type f -o -type l ) -name "*.py[co]" -delete
find {envdir} -type d -name "__pycache__" -delete
- bash -ec "nosetests {posargs:test/unit} --with-id || nosetests --failed"
+ bash -ec "pytest {posargs:test/unit} || pytest --last-failed {posargs:test/unit}"
allowlist_externals =
bash
find
@@ -27,7 +27,7 @@ passenv = SWIFT_* *_proxy
usedevelop = False
deps = {[testenv:py36]deps}
commands =
- nosetests {posargs:test/s3api}
+ pytest {posargs:test/s3api}
passenv = SWIFT_* *_proxy
[testenv:py27]
@@ -47,10 +47,6 @@ deps = {[testenv:py36]deps}
[testenv:cover]
setenv = VIRTUAL_ENV={envdir}
- NOSE_WITH_COVERAGE=1
- NOSE_COVER_BRANCHES=1
- NOSE_COVER_HTML=1
- NOSE_COVER_HTML_DIR={toxinidir}/cover
[testenv:pep8]
commands =