Skip to content

Commit

Permalink
tests: fix project creation test
Browse files Browse the repository at this point in the history
  • Loading branch information
ap-- committed Aug 8, 2020
1 parent 65e0205 commit 8825c47
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion paquo/tests/test_projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,21 @@ def test_project_creation_mode(mode, tmp_path2, new_project):
new_project.save()
del new_project
assert not p.with_suffix('.qpproj.backup').is_file()
assert not any(p.parent.parent.glob('*.backup'))

# test creating in existing dir
cm = pytest.raises(FileExistsError) if "x" in mode else nullcontext()
with cm:
QuPathProject(p, mode=mode).save()

assert p.is_file()
assert p.with_suffix('.qpproj.backup').is_file() is ('x' not in mode)
backups = list(p.parent.parent.glob('*.backup'))

if 'w' in mode:
assert len(backups) == 1
assert backups[0].is_file()
else:
assert len(backups) == 0


# noinspection PyTypeChecker
Expand Down

0 comments on commit 8825c47

Please sign in to comment.