Skip to content

Commit

Permalink
umu_test: update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
R1kaB3rN committed Sep 5, 2024
1 parent 098ad54 commit bbefc49
Showing 1 changed file with 56 additions and 9 deletions.
65 changes: 56 additions & 9 deletions umu/umu_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1428,8 +1428,6 @@ def test_build_command_noruntime(self):
os.environ["PROTONPATH"] = self.test_file
os.environ["GAMEID"] = self.test_file
os.environ["STORE"] = self.test_file
# Setting this mocks a Flatpak environment and UMU_NO_RUNTIME is
# only valid for Flatpak apps
os.environ["UMU_NO_RUNTIME"] = "1"
# Args
result_args = umu_run.parse_args()
Expand All @@ -1439,14 +1437,40 @@ def test_build_command_noruntime(self):
umu_run.setup_pfx(self.env["WINEPREFIX"])
# Env
umu_run.set_env(self.env, result_args)
# Mock setting UMU_NO_RUNTIME. This will not be set in the function
# because the FLATPAK_PATH constant will evaluate to None
self.env["UMU_NO_RUNTIME"] = os.environ["UMU_NO_RUNTIME"]
# Game drive
umu_run.enable_steam_game_drive(self.env)

os.environ |= self.env

# Mock setting up the runtime
with (
patch.object(umu_runtime, "_install_umu", return_value=None),
):
umu_runtime.setup_umu(
self.test_user_share, self.test_local_share, None
)
copytree(
Path(self.test_user_share, "sniper_platform_0.20240125.75305"),
Path(
self.test_local_share, "sniper_platform_0.20240125.75305"
),
dirs_exist_ok=True,
symlinks=True,
)
copy(
Path(self.test_user_share, "run"),
Path(self.test_local_share, "run"),
)
copy(
Path(self.test_user_share, "run-in-sniper"),
Path(self.test_local_share, "run-in-sniper"),
)
copy(
Path(self.test_user_share, "umu"),
Path(self.test_local_share, "umu"),
)

# Build
test_command = umu_run.build_command(self.env, self.test_local_share)
self.assertIsInstance(
Expand Down Expand Up @@ -1482,8 +1506,6 @@ def test_build_command_nopv(self):
os.environ["PROTONPATH"] = self.test_file
os.environ["GAMEID"] = self.test_file
os.environ["STORE"] = self.test_file
# Setting this mocks a Flatpak environment and UMU_NO_RUNTIME is
# only valid for Flatpak apps
os.environ["UMU_NO_RUNTIME"] = "pressure-vessel"
# Args
result_args = umu_run.parse_args()
Expand All @@ -1493,12 +1515,37 @@ def test_build_command_nopv(self):
umu_run.setup_pfx(self.env["WINEPREFIX"])
# Env
umu_run.set_env(self.env, result_args)
# Mock setting UMU_NO_RUNTIME. This will not be set in the function
# because the FLATPAK_PATH constant will evaluate to None
self.env["UMU_NO_RUNTIME"] = os.environ["UMU_NO_RUNTIME"]
# Game drive
umu_run.enable_steam_game_drive(self.env)

# Mock setting up the runtime
with (
patch.object(umu_runtime, "_install_umu", return_value=None),
):
umu_runtime.setup_umu(
self.test_user_share, self.test_local_share, None
)
copytree(
Path(self.test_user_share, "sniper_platform_0.20240125.75305"),
Path(
self.test_local_share, "sniper_platform_0.20240125.75305"
),
dirs_exist_ok=True,
symlinks=True,
)
copy(
Path(self.test_user_share, "run"),
Path(self.test_local_share, "run"),
)
copy(
Path(self.test_user_share, "run-in-sniper"),
Path(self.test_local_share, "run-in-sniper"),
)
copy(
Path(self.test_user_share, "umu"),
Path(self.test_local_share, "umu"),
)

os.environ |= self.env

# Build
Expand Down

0 comments on commit bbefc49

Please sign in to comment.