summaryrefslogtreecommitdiff
path: root/conftest.py
blob: 25537f56e5cf9254e3e3ea3a0020e89b8023373b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import sys


pytest_plugins = 'setuptools.tests.fixtures'


def pytest_addoption(parser):
    parser.addoption(
        "--package_name", action="append", default=[],
        help="list of package_name to pass to test functions",
    )


collect_ignore = [
    'tests/manual_test.py',
    'setuptools/tests/mod_with_constant.py',
    'setuptools/_distutils',
    '_distutils_hack',
]


def pytest_configure(config):
    disable_coverage_on_pypy(config)


def disable_coverage_on_pypy(config):
    """
    Coverage makes tests on PyPy unbearably slow, so disable it.
    """
    if '__pypy__' not in sys.builtin_module_names:
        return

    # Recommended at pytest-dev/pytest-cov#418
    cov = config.pluginmanager.get_plugin('_cov')
    cov.options.no_cov = True
    if cov.cov_controller:
        cov.cov_controller.pause()


if sys.version_info < (3,):
    collect_ignore.append('setuptools/lib2to3_ex.py')
    collect_ignore.append('setuptools/_imp.py')


if sys.version_info < (3, 6):
    collect_ignore.append('pavement.py')