Skip to content

Commit

Permalink
Make 'python setup.py test' work (#5)
Browse files Browse the repository at this point in the history
* Make 'python setup.py test' work

Packagers sometimes like to use 'python setup.py test'. This
change adjusts setup.py and setup.cfg to allow this to work
with pytest instead of nose. To make things work, the
settings for coverage need to be moved into tox.ini.

A SkipTest in test_config_middleware is changed to its pytest
equivalent.

* Remove usedevelop from tox.ini

Review of improvements to setup.py indicated issues with the
tox.ini.
  • Loading branch information
cdent committed Nov 26, 2018
1 parent d18b052 commit eacb37d
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
1 change: 0 additions & 1 deletion pytest.ini
@@ -1,3 +1,2 @@
[pytest]
addopts = --cov=paste/deploy --cov-report=xml --cov-report=html --cov-report=term-missing
testpaths = tests
3 changes: 3 additions & 0 deletions setup.cfg
@@ -1,2 +1,5 @@
[wheel]
universal = true

[aliases]
test = pytest
4 changes: 2 additions & 2 deletions setup.py
Expand Up @@ -42,8 +42,8 @@
packages=find_packages(exclude=['tests']),
include_package_data=True,
zip_safe=False,
test_suite='nose.collector',
tests_require=['nose>=0.11'],
setup_requires=['pytest-runner'],
tests_require=['pytest'],
extras_require={
'Config': [],
'Paste': ['Paste'],
Expand Down
2 changes: 1 addition & 1 deletion tests/test_config_middleware.py
Expand Up @@ -20,7 +20,7 @@ def test_error():
try:
from paste.fixture import TestApp
except ImportError:
raise SkipTest
raise pytest.skip('unable to import TestApp')

wrapped = ConfigMiddleware(app_with_exception, {'test': 1})
test_app = TestApp(wrapped)
Expand Down
3 changes: 1 addition & 2 deletions tox.ini
Expand Up @@ -2,11 +2,10 @@
envlist = py27, py34, py35, py36, py37, pypy, pypy3

[testenv]
usedevelop = True
deps =
# Paste works on Python 3 since Paste 2.0
Paste
pytest
pytest-cov
commands =
py.test {posargs}
py.test --cov=paste/deploy --cov-report=xml --cov-report=html --cov-report=term-missing {posargs}

0 comments on commit eacb37d

Please sign in to comment.