Skip to content

Commit

Permalink
finicky test
Browse files Browse the repository at this point in the history
  • Loading branch information
shapiromatron committed Jul 10, 2024
1 parent cc1ba35 commit 7a24d8d
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions tests/desktop/components/test_database_form.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import sys
import tempfile
from pathlib import Path

Expand All @@ -8,9 +9,16 @@

def test_additional_path_checks():
# cannot write to this path
p = Path("/root/test.txt")
with pytest.raises(ValueError, match="Cannot create path"):
database_form.additional_path_checks(p)

match = None
if sys.platform == "darwin":
match = "Cannot create path"
elif sys.platform == "linux":
match = "Permission denied"
if match:
p = Path("/root/test.txt")
with pytest.raises(ValueError, match=match):
database_form.additional_path_checks(p)

# non sqlite file
with tempfile.NamedTemporaryFile(mode="w") as f:
Expand Down

0 comments on commit 7a24d8d

Please sign in to comment.