Skip to content

Commit 96eaead

Browse files
committed
umu_test: add tests when assigning GE-Proton for PROTONPATH
1 parent 804b71f commit 96eaead

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

umu/umu_test.py

+47
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,53 @@ def tearDown(self):
163163
if self.test_local_share.exists():
164164
rmtree(self.test_local_share.as_posix())
165165

166+
def test_ge_proton(self):
167+
"""Test check_env when the code name GE-Proton is set for PROTONPATH.
168+
169+
Tests the case when the user has no internet connection or GE-Proton
170+
wasn't found in local system.
171+
"""
172+
test_archive = self.test_archive.rename("GE-Proton9-2.tar.gz")
173+
umu_dl_util._extract_dir(test_archive, self.test_compat)
174+
175+
with (
176+
self.assertRaises(FileNotFoundError),
177+
patch.object(umu_dl_util, "_fetch_releases", return_value=None),
178+
patch.object(umu_dl_util, "_get_latest", return_value=None),
179+
patch.object(umu_dl_util, "_get_from_steamcompat", return_value=None),
180+
):
181+
os.environ["WINEPREFIX"] = self.test_file
182+
os.environ["GAMEID"] = self.test_file
183+
os.environ["PROTONPATH"] = "GE-Proton"
184+
umu_run.check_env(self.env)
185+
self.assertEqual(
186+
self.env["PROTONPATH"],
187+
self.test_compat.joinpath(
188+
self.test_archive.name[: self.test_archive.name.find(".tar.gz")]
189+
).as_posix(),
190+
"Expected PROTONPATH to be proton dir in compat",
191+
)
192+
193+
test_archive.unlink()
194+
195+
def test_ge_proton_none(self):
196+
"""Test check_env when the code name GE-Proton is set for PROTONPATH.
197+
198+
Tests the case when the user has no internet connection or GE-Proton
199+
wasn't found in local system.
200+
"""
201+
with (
202+
self.assertRaises(FileNotFoundError),
203+
patch.object(umu_dl_util, "_fetch_releases", return_value=None),
204+
patch.object(umu_dl_util, "_get_latest", return_value=None),
205+
patch.object(umu_dl_util, "_get_from_steamcompat", return_value=None),
206+
):
207+
os.environ["WINEPREFIX"] = self.test_file
208+
os.environ["GAMEID"] = self.test_file
209+
os.environ["PROTONPATH"] = "GE-Proton"
210+
umu_run.check_env(self.env)
211+
self.assertFalse(os.environ.get("PROTONPATH"), "Expected empty string")
212+
166213
def test_update_umu_empty(self):
167214
"""Test _update_umu by mocking an update to the runtime tools.
168215

0 commit comments

Comments
 (0)