From e9d798914091faa9b85ffc17b9bc756a08074d38 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Mon, 20 Jun 2016 22:30:36 +0200 Subject: [PATCH] Ignore hidden files (.testmondata) in test_pytest_collect_file `test_pytest_collect_file` fails if you run the tests using `--testmon`, because pytest-testmon will put its DB there as `.testmondata`. --- testing/test_collection.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/testing/test_collection.py b/testing/test_collection.py index 749c5b7ce..cd0a5cc19 100644 --- a/testing/test_collection.py +++ b/testing/test_collection.py @@ -150,7 +150,9 @@ class TestCollectPluginHookRelay: wascalled = [] class Plugin: 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") pytest.main([testdir.tmpdir], plugins=[Plugin()]) assert len(wascalled) == 1