Skip to content

Commit

Permalink
tests: activate mode='r' test for QuPathProject
Browse files Browse the repository at this point in the history
  • Loading branch information
ap-- committed Aug 20, 2020
1 parent 019d656 commit 9a59f22
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions paquo/tests/test_projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ def test_project_creation_input_error(tmp_path):
# noinspection PyTypeChecker
@pytest.mark.parametrize(
"mode", [
pytest.param('r', marks=pytest.mark.xfail), # not implemented yet
'r+', 'w', 'w+', 'a', 'a+', 'x', 'x+'
'r', 'r+', 'w', 'w+', 'a', 'a+', 'x', 'x+'
]
)
def test_project_creation_mode(mode, tmp_path2, new_project):
Expand All @@ -76,7 +75,12 @@ def test_project_creation_mode(mode, tmp_path2, new_project):
assert not any(p.parent.parent.glob('*.backup'))

# test creating in existing dir
cm = pytest.raises(FileExistsError) if "x" in mode else nullcontext()
if "x" in mode:
cm = pytest.raises(FileExistsError)
elif "r" == mode:
cm = pytest.raises(IOError) # can't save!
else:
cm = nullcontext()
with cm:
QuPathProject(p, mode=mode).save()

Expand Down

0 comments on commit 9a59f22

Please sign in to comment.