Skip to content

Commit a3107fd

Browse files
committed
test: improve resource file modification simulation for validation
1 parent 9a58278 commit a3107fd

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

tests/robotcode/robot/diagnostics/test_namespace_cache.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -447,8 +447,11 @@ def test_resource_dependency_changed_fails(self, tmp_path: Path) -> None:
447447

448448
meta = ImportsManager.build_namespace_meta(im, str(source), ns)
449449

450-
# Modify resource file
451-
res_file.write_text("*** Keywords ***\nModified\n")
450+
# Simulate resource file modification by shifting the stored mtime.
451+
# More reliable than writing the file again (Windows NTFS mtime
452+
# resolution can cause identical timestamps for fast writes).
453+
res_key = f"res:{res_file}"
454+
meta.dependency_fingerprints[res_key].mtime_ns -= 1
452455
assert ImportsManager.validate_namespace_meta(im, meta) is False
453456

454457
def test_resource_dependency_deleted_fails(self, tmp_path: Path) -> None:

0 commit comments

Comments
 (0)