From 050ce8237306feff08ec69cc32abc0eabe219fd5 Mon Sep 17 00:00:00 2001 From: R1kaB3rN <100738684+R1kaB3rN@users.noreply.github.com> Date: Wed, 28 Feb 2024 13:34:18 -0800 Subject: [PATCH] ulwgl_test: update tests to mock setting up the runtime on update - The runtime files have been removed from the repo and will no longer be stored in the root directory along with the launcher files. Therefore, an error will be raised when attempting to locate the runtime directory from the configuration file --- ULWGL/ulwgl_test.py | 68 +++++++++++++++++++++++++++++++++++---------- 1 file changed, 54 insertions(+), 14 deletions(-) diff --git a/ULWGL/ulwgl_test.py b/ULWGL/ulwgl_test.py index 8001ebd5d..ac41224bf 100644 --- a/ULWGL/ulwgl_test.py +++ b/ULWGL/ulwgl_test.py @@ -200,13 +200,33 @@ def test_update_ulwgl_empty(self): ) # Update - result = ulwgl_util._update_ulwgl( - self.test_user_share, - self.test_local_share, - self.test_compat, - json_root, - json_local, - ) + with patch.object( + ulwgl_util, + "setup_runtime", + return_value=None, + ): + result = ulwgl_util._update_ulwgl( + self.test_user_share, + self.test_local_share, + self.test_compat, + json_root, + json_local, + ) + ulwgl_util.copyfile_tree( + Path(self.test_user_share, "sniper_platform_0.20240125.75305"), + Path(self.test_local_share, "sniper_platform_0.20240125.75305"), + ) + ulwgl_util.copyfile_reflink( + Path(self.test_user_share, "run"), Path(self.test_local_share, "run") + ) + ulwgl_util.copyfile_reflink( + Path(self.test_user_share, "run-in-sniper"), + Path(self.test_local_share, "run-in-sniper"), + ) + ulwgl_util.copyfile_reflink( + Path(self.test_user_share, "ULWGL"), + Path(self.test_local_share, "ULWGL"), + ) self.assertFalse(result, "Expected None when calling _update_ulwgl") @@ -434,13 +454,33 @@ def test_update_ulwgl(self): filer.write("foo") # Update - result = ulwgl_util._update_ulwgl( - self.test_user_share, - self.test_local_share, - self.test_compat, - json_root, - json_local, - ) + with patch.object( + ulwgl_util, + "setup_runtime", + return_value=None, + ): + result = ulwgl_util._update_ulwgl( + self.test_user_share, + self.test_local_share, + self.test_compat, + json_root, + json_local, + ) + ulwgl_util.copyfile_tree( + Path(self.test_user_share, "sniper_platform_0.20240125.75305"), + Path(self.test_local_share, "sniper_platform_0.20240125.75305"), + ) + ulwgl_util.copyfile_reflink( + Path(self.test_user_share, "run"), Path(self.test_local_share, "run") + ) + ulwgl_util.copyfile_reflink( + Path(self.test_user_share, "run-in-sniper"), + Path(self.test_local_share, "run-in-sniper"), + ) + ulwgl_util.copyfile_reflink( + Path(self.test_user_share, "ULWGL"), + Path(self.test_local_share, "ULWGL"), + ) self.assertFalse(result, "Expected None when calling _update_ulwgl")