Skip to content

Commit 0d0e014

Browse files
committed
add tests for error raising when resetting with additional files in project folder
1 parent c3469cf commit 0d0e014

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

tests/test_public_api.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,15 @@ def test_project_build(
291291
project2 = Project.from_json(tmp_path / "project.json")
292292
assert project2.origin_dataset == project.outputs["original"]["dataset"]
293293

294+
# Resetting with an additional file in the project root should raise an error
295+
(tmp_path / "pinnifred.txt").touch()
296+
with pytest.raises(RuntimeError, match=r"pinnifred.txt"):
297+
project.reset()
298+
299+
# Files added in the "other" folder are moved in the project root after reset
300+
new_file_in_other = (tmp_path / "pinnifred.txt").replace(tmp_path / "other")
301+
files_before_build.append(new_file_in_other)
302+
294303
# Resetting the project should put back all original files back
295304
project.reset()
296305
assert sorted(str(file) for file in tmp_path.rglob("*")) == sorted(

0 commit comments

Comments
 (0)