diff --git a/tests/test_schematic_analysis.py b/tests/test_schematic_analysis.py index 52b8f18..734616b 100644 --- a/tests/test_schematic_analysis.py +++ b/tests/test_schematic_analysis.py @@ -2,6 +2,7 @@ import pytest + @pytest.mark.unit class TestRunSchematicErc: """Tests for the run_schematic_erc tool.""" @@ -182,14 +183,22 @@ class TestErcJsonParsing: from mckicad.tools.schematic_analysis import run_schematic_erc - # Create a project structure with root + sub-sheet - pro_file = tmp_path / "myproject.kicad_pro" + # Anchor the project in its own subdirectory. The autouse + # _set_test_search_paths fixture drops a second "test_project.kicad_pro" + # into tmp_path; keeping our project one level down means the root walk + # finds *this* project's .kicad_pro and stops before it reaches (and is + # confused by) the sibling. Without this, resolution depends on + # os.listdir order, which differs between ext4 and APFS. + proj_dir = tmp_path / "myproject" + proj_dir.mkdir() + + pro_file = proj_dir / "myproject.kicad_pro" pro_file.write_text("{}") - root_sch = tmp_path / "myproject.kicad_sch" + root_sch = proj_dir / "myproject.kicad_sch" root_sch.write_text('(kicad_sch (version 20231120) (uuid "root"))\n') - sub_dir = tmp_path / "sub" + sub_dir = proj_dir / "sub" sub_dir.mkdir() sub_sch = sub_dir / "power.kicad_sch" sub_sch.write_text('(kicad_sch (version 20231120) (uuid "sub"))\n')