From a0180ce0c0a4dff44ea0d07762ebc76bf67e1bd7 Mon Sep 17 00:00:00 2001 From: Thomas De Schampheleire Date: Wed, 3 Feb 2016 22:32:28 +0100 Subject: [PATCH] pytest migration: switch to pytest; remove nose support 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 https://github.com/pytest-dev/pytest/issues/567 and https://bitbucket.org/pytest-dev/pytest-runner/issues/7/support-all-pytest-commands . --- kallithea/tests/parameterized.py | 7 ------- pytest.ini | 9 +++++++++ setup.cfg | 18 ++---------------- setup.py | 9 ++++----- 4 files changed, 15 insertions(+), 28 deletions(-) create mode 100644 pytest.ini diff --git a/kallithea/tests/parameterized.py b/kallithea/tests/parameterized.py index 94ca2303..36ea7336 100644 --- a/kallithea/tests/parameterized.py +++ b/kallithea/tests/parameterized.py @@ -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: diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 00000000..e3913932 --- /dev/null +++ b/pytest.ini @@ -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 diff --git a/setup.cfg b/setup.cfg index 8836fb6b..c38568ce 100644 --- a/setup.cfg +++ b/setup.cfg @@ -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 diff --git a/setup.py b/setup.py index 76fef829..ab3bfc05 100755 --- a/setup.py +++ b/setup.py @@ -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", ] @@ -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), @@ -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 """, )