Fix cross-platform flakiness in ERC root-resolution test
Some checks are pending
CI / Lint and Format (push) Waiting to run
CI / Test Python 3.11 on macos-latest (push) Waiting to run
CI / Test Python 3.12 on macos-latest (push) Waiting to run
CI / Test Python 3.13 on macos-latest (push) Waiting to run
CI / Test Python 3.10 on ubuntu-latest (push) Waiting to run
CI / Test Python 3.11 on ubuntu-latest (push) Waiting to run
CI / Test Python 3.12 on ubuntu-latest (push) Waiting to run
CI / Test Python 3.13 on ubuntu-latest (push) Waiting to run
CI / Security Scan (push) Waiting to run
CI / Build Package (push) Blocked by required conditions
Some checks are pending
CI / Lint and Format (push) Waiting to run
CI / Test Python 3.11 on macos-latest (push) Waiting to run
CI / Test Python 3.12 on macos-latest (push) Waiting to run
CI / Test Python 3.13 on macos-latest (push) Waiting to run
CI / Test Python 3.10 on ubuntu-latest (push) Waiting to run
CI / Test Python 3.11 on ubuntu-latest (push) Waiting to run
CI / Test Python 3.12 on ubuntu-latest (push) Waiting to run
CI / Test Python 3.13 on ubuntu-latest (push) Waiting to run
CI / Security Scan (push) Waiting to run
CI / Build Package (push) Blocked by required conditions
test_root_resolves_to_project_schematic built its project directly in tmp_path, where the autouse _set_test_search_paths fixture also drops a test_project.kicad_pro. With two .kicad_pro files in one directory, root resolution returned whichever os.listdir yielded first — myproject on ext4, test_project on APFS — so it passed on Linux and failed on macOS. Anchor the test's project in its own subdirectory so the walk stops at the intended root.
This commit is contained in:
parent
1dca4d6912
commit
6e982797f8
@ -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')
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user