From 9d8b264f4caed0596113a5c005548d48589213aa Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Fri, 23 Sep 2016 08:47:16 -0300 Subject: [PATCH 1/2] Implement correct fix for #25 pytest_collect_file should return None if it can't collect the path, not False --- CHANGELOG.md | 4 ++++ pytest_cpp/plugin.py | 2 +- tests/test_pytest_cpp.py | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8774c94..2bf486c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# 0.4.2 # + +- Proper fix for #25, the fix made in `0.4.1` was incorrect. + # 0.4.1 # - Fix error that may happen during collection when using xdist (#25). diff --git a/pytest_cpp/plugin.py b/pytest_cpp/plugin.py index 6243ad4..9651387 100644 --- a/pytest_cpp/plugin.py +++ b/pytest_cpp/plugin.py @@ -17,7 +17,7 @@ def pytest_collect_file(parent, path): is_executable = os.stat(str(path)).st_mode & stat.S_IXUSR except OSError: # in some situations the file might not be available anymore at this point - return False + is_executable = False if not is_executable: return masks = parent.config.getini('cpp_files') or DEFAULT_MASKS diff --git a/tests/test_pytest_cpp.py b/tests/test_pytest_cpp.py index 8c15939..dab3040 100644 --- a/tests/test_pytest_cpp.py +++ b/tests/test_pytest_cpp.py @@ -254,7 +254,7 @@ def test_race_condition_on_collect(tmpdir): '/../test_duplicate_filenames.cpython-27-PYTEST.pyc.21746' """ import pytest_cpp.plugin - assert not pytest_cpp.plugin.pytest_collect_file(None, tmpdir / 'invalid-file') + assert pytest_cpp.plugin.pytest_collect_file(None, tmpdir / 'invalid-file') is None class TestError: From 545488fdf4dcdb1908ab14f0a9bdbcb328dbf3ab Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Fri, 23 Sep 2016 08:47:37 -0300 Subject: [PATCH 2/2] Bump version to 0.4.2 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index b46ad18..dd5d79b 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ setup( name="pytest-cpp", - version='0.4.1', + version='0.4.2', packages=['pytest_cpp'], entry_points={ 'pytest11': ['cpp = pytest_cpp.plugin'],