Skip to content

Commit 9d8b264

Browse files
committed
Implement correct fix for #25
pytest_collect_file should return None if it can't collect the path, not False
1 parent c32675e commit 9d8b264

3 files changed

Lines changed: 6 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# 0.4.2 #
2+
3+
- Proper fix for #25, the fix made in `0.4.1` was incorrect.
4+
15
# 0.4.1 #
26

37
- Fix error that may happen during collection when using xdist (#25).

pytest_cpp/plugin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def pytest_collect_file(parent, path):
1717
is_executable = os.stat(str(path)).st_mode & stat.S_IXUSR
1818
except OSError:
1919
# in some situations the file might not be available anymore at this point
20-
return False
20+
is_executable = False
2121
if not is_executable:
2222
return
2323
masks = parent.config.getini('cpp_files') or DEFAULT_MASKS

tests/test_pytest_cpp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ def test_race_condition_on_collect(tmpdir):
254254
'/../test_duplicate_filenames.cpython-27-PYTEST.pyc.21746'
255255
"""
256256
import pytest_cpp.plugin
257-
assert not pytest_cpp.plugin.pytest_collect_file(None, tmpdir / 'invalid-file')
257+
assert pytest_cpp.plugin.pytest_collect_file(None, tmpdir / 'invalid-file') is None
258258

259259

260260
class TestError:

0 commit comments

Comments
 (0)