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
 
import re
 
import new
 
import inspect
 
import logging
 
import logging.handlers
 
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)
 

	
 
    return func
 

	
 

	
 
def _terrible_magic_get_defining_classes():
 
    """ Returns the set of parent classes of the class currently being defined.
 
        Will likely only work if called from the ``parameterized`` decorator.
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
 

	
 
[extract_messages]
 
add_comments = TRANSLATORS:
 
output_file = kallithea/i18n/kallithea.pot
 
msgid-bugs-address = translations@kallithea-scm.org
 
copyright-holder = Various authors, licensing as GPLv3
 
no-wrap = true
setup.py
Show inline comments
 
@@ -45,24 +45,25 @@ requirements = [
 
    "SQLAlchemy==0.7.10",
 
    "Mako>=0.9.0,<=1.0.0",
 
    "pygments>=1.5",
 
    "whoosh>=2.4.0,<=2.5.7",
 
    "celery>=2.2.5,<2.3",
 
    "babel>=0.9.6,<=1.3",
 
    "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")
 
    requirements.append("unittest2")
 
    requirements.append("argparse")
 

	
 
if not is_windows:
 
    requirements.append("py-bcrypt>=0.3.0,<=0.4")
 

	
 
@@ -138,29 +139,30 @@ setup(
 
    name='Kallithea',
 
    version=__version__,
 
    description=description,
 
    long_description=long_description,
 
    keywords=keywords,
 
    license=__license__,
 
    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)]},
 
    zip_safe=False,
 
    paster_plugins=['PasteScript', 'Pylons'],
 
    entry_points="""
 
    [console_scripts]
 
    kallithea-api =    kallithea.bin.kallithea_api:main
 
    kallithea-gist =   kallithea.bin.kallithea_gist:main
 
@@ -175,17 +177,14 @@ setup(
 
    [paste.global_paster_command]
 
    setup-db=kallithea.lib.paster_commands.setup_db:Command
 
    cleanup-repos=kallithea.lib.paster_commands.cleanup:Command
 
    update-repoinfo=kallithea.lib.paster_commands.update_repoinfo:Command
 
    make-rcext=kallithea.lib.paster_commands.make_rcextensions:Command
 
    repo-scan=kallithea.lib.paster_commands.repo_scan:Command
 
    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)