tests: Ignore roots using 'collect_ignore'

This is slightly cleaner than how we're doing this at the moment.

Signed-off-by: Stephen Finucane <stephen@that.guru>
This commit is contained in:
Stephen Finucane 2017-10-26 16:59:46 +01:00
parent e243e82723
commit c8d56236c9
2 changed files with 5 additions and 11 deletions

View File

@ -15,9 +15,12 @@ from sphinx.testing.path import path
pytest_plugins = 'sphinx.testing.fixtures' pytest_plugins = 'sphinx.testing.fixtures'
# Exclude 'roots' dirs for pytest test collector
collect_ignore = ['roots']
# Disable Python version-specific # Disable Python version-specific
if sys.version_info < (3, 5): if sys.version_info < (3, 5):
collect_ignore = ['py35'] collect_ignore += ['py35']
@pytest.fixture(scope='session') @pytest.fixture(scope='session')

View File

@ -55,14 +55,5 @@ os.makedirs(tempdir)
print('Running Sphinx test suite (with Python %s)...' % sys.version.split()[0]) print('Running Sphinx test suite (with Python %s)...' % sys.version.split()[0])
sys.stdout.flush() sys.stdout.flush()
# exclude 'roots' dirs for pytest test collector
ignore_paths = [
os.path.relpath(os.path.join(os.path.dirname(os.path.abspath(__file__)), sub))
for sub in ('roots',)
]
args = sys.argv[1:]
for ignore_path in ignore_paths:
args.extend(['--ignore', ignore_path])
import pytest # NOQA import pytest # NOQA
sys.exit(pytest.main(args)) sys.exit(pytest.main(sys.argv[1:]))