Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /acts/CI/test_check_unused_files.py was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 """Exercise reference matching and search failures with real grep calls."""
0002 
0003 import subprocess
0004 
0005 import pytest
0006 
0007 from check_unused_files import file_can_be_removed
0008 
0009 
0010 def test_reference_matching(tmp_path):
0011     (tmp_path / "references.txt").write_text(
0012         "#include <used.hpp>\nimport package.module\n"
0013     )
0014     scope = [str(tmp_path)]
0015     assert not file_can_be_removed("used.hpp", scope)
0016     assert not file_can_be_removed(r"import .*module", scope)
0017     assert file_can_be_removed("unused.hpp", scope)
0018 
0019 
0020 def test_search_failure(tmp_path):
0021     with pytest.raises(subprocess.CalledProcessError):
0022         file_can_be_removed("unused.hpp", [str(tmp_path / "missing")])