Skip to content

Commit

Permalink
pytest migration: switch to pytest; remove nose support
Browse files Browse the repository at this point in the history
Make pytest the default test runner and remove support for nose.
Tests can be run using:
   - py.test
   - python setup.py test

The pytest configuration needs to move from setup.cfg to pytest.ini to support
this - see pytest-dev/pytest#567 and
https://bitbucket.org/pytest-dev/pytest-runner/issues/7/support-all-pytest-commands .
  • Loading branch information
patrickdepinguin committed Feb 3, 2016
1 parent 6b93a13 commit a0180ce
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 28 deletions.
7 changes: 0 additions & 7 deletions kallithea/tests/parameterized.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,6 @@


def skip_test(func):
try:
from nose.tools import nottest
except ImportError:
pass
else:
func = nottest(func)

try:
import pytest
except ImportError:
Expand Down
9 changes: 9 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[pytest]
# only look for tests in kallithea/tests
python_files = kallithea/tests/**/test_*.py
addopts =
# --verbose
# show extra test summary info as specified by chars (f)ailed, (E)error, (s)skipped, (x)failed, (X)passed, (w)warnings.
-rfEsxXw
# Shorter scrollbacks; less stuff to scroll through
--tb=short
18 changes: 2 additions & 16 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,8 @@ tag_build =
tag_svn_revision = 0
tag_date = 0

[nosetests]
verbose = True
verbosity = 2
with-pylons = kallithea/tests/test.ini
detailed-errors = 1
nologcapture = 1

[pytest]
# only look for tests in kallithea/tests
python_files = kallithea/tests/**/test_*.py
addopts =
# --verbose
# show extra test summary info as specified by chars (f)ailed, (E)error, (s)skipped, (x)failed, (X)passed, (w)warnings.
-rfEsxXw
# Shorter scrollbacks; less stuff to scroll through
--tb=short
[aliases]
test = pytest

[compile_catalog]
domain = kallithea
Expand Down
9 changes: 4 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ def _get_meta_var(name, data, callback_handler=None):
"mock",
"URLObject==2.3.4",
"Routes==1.13",
"pytest>=2.7.0,<3.0",
"dulwich>=0.9.9,<=0.9.9",
"mercurial>=2.9,<3.7",
]
Expand Down Expand Up @@ -147,11 +148,12 @@ def initialize_options(self):
url=__url__,
install_requires=requirements,
classifiers=classifiers,
setup_requires=["PasteScript>=1.6.3"],
setup_requires=['PasteScript>=1.6.3',
'pytest-runner'],
tests_require=['pytest'],
data_files=data_files,
packages=packages,
include_package_data=True,
test_suite='nose.collector',
package_data=package_data,
message_extractors={'kallithea': [
('**.py', 'python', None),
Expand Down Expand Up @@ -184,8 +186,5 @@ def initialize_options(self):
upgrade-db=kallithea.lib.dbmigrate:UpgradeDb
celeryd=kallithea.lib.celerypylons.commands:CeleryDaemonCommand
install-iis=kallithea.lib.paster_commands.install_iis:Command
[nose.plugins]
pylons = pylons.test:PylonsPlugin
""",
)

0 comments on commit a0180ce

Please sign in to comment.