Changeset - d88077fae3d6
[Not reviewed]
default
0 3 1
Thomas De Schampheleire - 10 years ago 2016-02-03 22:32:28
thomas.de.schampheleire@gmail.com
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 .
4 files changed with 15 insertions and 28 deletions:
0 comments (0 inline, 0 general)
kallithea/tests/parameterized.py
Show inline comments
 
@@ -7,19 +7,12 @@ from functools import wraps
 

	
 
from unittest import TestCase
 

	
 

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

	
 
    try:
 
        import pytest
 
    except ImportError:
 
        pass
 
    else:
 
        func = pytest.mark.skipIf(True, func)
 

	
pytest.ini
Show inline comments
 
new file 100644
 
[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
setup.cfg
Show inline comments
 
[egg_info]
 
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
 
directory = kallithea/i18n
 
statistics = true
 

	
setup.py
Show inline comments
 
@@ -51,12 +51,13 @@ requirements = [
 
    "python-dateutil>=1.5.0,<2.0.0",
 
    "markdown==2.2.1",
 
    "docutils>=0.8.1,<=0.11",
 
    "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",
 
]
 

	
 
if sys.version_info < (2, 7):
 
    requirements.append("importlib==1.0.1")
 
@@ -144,17 +145,18 @@ setup(
 
    author=__author__,
 
    author_email='kallithea@sfconservancy.org',
 
    dependency_links=dependency_links,
 
    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),
 
            ('templates/**.mako', 'mako', {'input_encoding': 'utf-8'}),
 
            ('templates/**.html', 'mako', {'input_encoding': 'utf-8'}),
 
            ('public/**', 'ignore', None)]},
 
@@ -181,11 +183,8 @@ setup(
 
    cache-keys=kallithea.lib.paster_commands.cache_keys:Command
 
    ishell=kallithea.lib.paster_commands.ishell:Command
 
    make-index=kallithea.lib.paster_commands.make_index:Command
 
    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 (0 inline, 0 general)