Merge pull request #1623 from blueyed/ignore-hidden-files-in-test_pytest_collect_file

Ignore hidden files (.testmondata) in test_pytest_collect_file
This commit is contained in:
Bruno Oliveira 2016-06-21 13:17:20 -03:00 committed by GitHub
commit 2f9d5c2586
1 changed files with 3 additions and 1 deletions

View File

@ -150,7 +150,9 @@ class TestCollectPluginHookRelay:
wascalled = [] wascalled = []
class Plugin: class Plugin:
def pytest_collect_file(self, path, parent): def pytest_collect_file(self, path, parent):
wascalled.append(path) if not path.basename.startswith("."):
# Ignore hidden files, e.g. .testmondata.
wascalled.append(path)
testdir.makefile(".abc", "xyz") testdir.makefile(".abc", "xyz")
pytest.main([testdir.tmpdir], plugins=[Plugin()]) pytest.main([testdir.tmpdir], plugins=[Plugin()])
assert len(wascalled) == 1 assert len(wascalled) == 1