Skip to content

Commit

Permalink
Add bad data fixture, ensure test doesn't read real release file
Browse files Browse the repository at this point in the history
  • Loading branch information
eloquence committed Sep 9, 2020
1 parent 29d944d commit fd6b824
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions launcher/tests/fixtures/bad-os-release-file
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# No line
VERSION=
[we're doing toml now]
RELEASES = [ ["gamma", "delta"], [1, 2] ]
5 changes: 4 additions & 1 deletion launcher/tests/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ def test_detect_qubes(
("os-release-qubes-4.1", 5),
("os-release-ubuntu", 4),
("no-such-file", 4),
("bad-os-release-file", 4),
],
)
@mock.patch("Util.sdlog.error")
Expand Down Expand Up @@ -283,5 +284,7 @@ def test_pick_bad_qt(
version via environment override
"""
mocked_env = {"SDW_UPDATER_QT": env_override}
with mock.patch.dict("os.environ", mocked_env), pytest.raises(ValueError):
with mock.patch.dict("os.environ", mocked_env), mock.patch(
"Util.OS_RELEASE_FILE", os.path.join(FIXTURES_PATH, "os-release-qubes-4.0")
), pytest.raises(ValueError):
util.get_qt_version()

0 comments on commit fd6b824

Please sign in to comment.