Add ability to exclude files matching glob patterns in conftest.py

This adds the `collect_ignore_glob` option for `conftest.py` to allow
Unix-style wildcards for excluding files.
This commit is contained in:
Christian Fetzer
2019-02-06 10:50:46 +01:00
parent fc5d4654e5
commit 2dc2a19db5
4 changed files with 39 additions and 1 deletions

View File

@@ -303,7 +303,10 @@ def pytest_ignore_collect(path, config):
if py.path.local(path) in ignore_paths:
return True
ignore_globs = []
ignore_globs = config._getconftest_pathlist(
"collect_ignore_glob", path=path.dirpath()
)
ignore_globs = ignore_globs or []
excludeglobopt = config.getoption("ignore_glob")
if excludeglobopt:
ignore_globs.extend([py.path.local(x) for x in excludeglobopt])