"""Unit tests for runner helpers (no LTspice needed).""" from mcltspice.runner import _safe_copy class TestSafeCopy: def test_skips_same_file(self, tmp_path): # Copying a file onto itself must not raise (was SameFileError in batch runs). f = tmp_path / "a.cir" f.write_text("hello") _safe_copy(f, f) assert f.read_text() == "hello" def test_skips_same_file_via_unnormalized_path(self, tmp_path): # Same file referenced through a "." segment -> resolve() equal -> skip. f = tmp_path / "a.cir" f.write_text("x") alias = tmp_path / "." / "a.cir" _safe_copy(f, alias) # must not raise assert f.read_text() == "x" def test_copies_distinct_files(self, tmp_path): src = tmp_path / "a.cir" src.write_text("data") dst = tmp_path / "b.cir" _safe_copy(src, dst) assert dst.read_text() == "data"