|
@ -14,6 +14,7 @@ from pyenliven.mtpatches import ( # noqa F402 |
|
|
get_shallowest_files_sub, |
|
|
get_shallowest_files_sub, |
|
|
diff_only_head, |
|
|
diff_only_head, |
|
|
find_mod, |
|
|
find_mod, |
|
|
|
|
|
find_modpack, |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -97,6 +98,11 @@ class TestMTPatches(unittest.TestCase): |
|
|
find_mod(game_path, "mod1"), |
|
|
find_mod(game_path, "mod1"), |
|
|
os.path.join("mods", "extra_parent", "modpack1", "mod1") |
|
|
os.path.join("mods", "extra_parent", "modpack1", "mod1") |
|
|
) |
|
|
) |
|
|
|
|
|
self.assertEqual( |
|
|
|
|
|
find_mod(os.path.join(TESTS_DATA_DIR, "modpack_game"), "mod2"), |
|
|
|
|
|
os.path.join("mods", "extra_parent", "modpack2", "mod2") |
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
self.assertEqual( |
|
|
self.assertEqual( |
|
|
find_mod(os.path.join(game_path, "mods", "extra_parent", |
|
|
find_mod(os.path.join(game_path, "mods", "extra_parent", |
|
|
"modpack1", "mod1"), |
|
|
"modpack1", "mod1"), |
|
@ -108,6 +114,40 @@ class TestMTPatches(unittest.TestCase): |
|
|
os.path.join("extra_parent", "modpack1", "mod1"), |
|
|
os.path.join("extra_parent", "modpack1", "mod1"), |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
def test_find_modpack(self): |
|
|
|
|
|
game_path = os.path.join(TESTS_DATA_DIR, "modpack_game") |
|
|
|
|
|
self.assertEqual( |
|
|
|
|
|
find_modpack(game_path, "wrong_modpack"), |
|
|
|
|
|
None |
|
|
|
|
|
) |
|
|
|
|
|
self.assertEqual( |
|
|
|
|
|
find_modpack(game_path, "modpack1"), |
|
|
|
|
|
os.path.join("mods", "extra_parent", "modpack1") |
|
|
|
|
|
) |
|
|
|
|
|
self.assertEqual( |
|
|
|
|
|
find_modpack(os.path.join(TESTS_DATA_DIR, "modpack_game"), |
|
|
|
|
|
"modpack2"), |
|
|
|
|
|
os.path.join("mods", "extra_parent", "modpack2") |
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
self.assertEqual( |
|
|
|
|
|
find_modpack(os.path.join(game_path, "mods", "extra_parent", |
|
|
|
|
|
"modpack1"), |
|
|
|
|
|
"modpack1"), # Yes, still find mod1 ("") if root |
|
|
|
|
|
"" |
|
|
|
|
|
) |
|
|
|
|
|
self.assertEqual( |
|
|
|
|
|
find_modpack(os.path.join(game_path, "mods", "extra_parent", |
|
|
|
|
|
"modpack2"), |
|
|
|
|
|
"modpack2"), # Yes, still find mod1 ("") if root |
|
|
|
|
|
"" |
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
self.assertEqual( |
|
|
|
|
|
find_modpack(os.path.join(game_path, "mods"), "modpack1"), |
|
|
|
|
|
os.path.join("extra_parent", "modpack1"), |
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__": |
|
|
if __name__ == "__main__": |
|
|
unittest.main() |
|
|
unittest.main() |
|
|