changeset 5700:d88077fae3d6

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 .
author Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
date Wed, 03 Feb 2016 22:32:28 +0100
parents 6a83b399bb3c
children 2d2decce586f
files kallithea/tests/parameterized.py pytest.ini setup.cfg setup.py
diffstat 4 files changed, 15 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/tests/parameterized.py	Wed Feb 03 22:14:36 2016 +0100
+++ b/kallithea/tests/parameterized.py	Wed Feb 03 22:32:28 2016 +0100
@@ -10,13 +10,6 @@
 
 def skip_test(func):
     try:
-        from nose.tools import nottest
-    except ImportError:
-        pass
-    else:
-        func = nottest(func)
-
-    try:
         import pytest
     except ImportError:
         pass
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/pytest.ini	Wed Feb 03 22:32:28 2016 +0100
@@ -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
--- a/setup.cfg	Wed Feb 03 22:14:36 2016 +0100
+++ b/setup.cfg	Wed Feb 03 22:32:28 2016 +0100
@@ -3,22 +3,8 @@
 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
--- a/setup.py	Wed Feb 03 22:14:36 2016 +0100
+++ b/setup.py	Wed Feb 03 22:32:28 2016 +0100
@@ -54,6 +54,7 @@
     "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 @@
     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 @@
     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
     """,
 )