From fab85616c74f089185f6a18a382c7cc0dcc2c0fe Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 27 Nov 2017 11:23:24 +0100 Subject: [PATCH] Remove test for upgrading from legacy stacks to modern stacks This is because ContainerRegistry.saveAll has been removed. That function was only used by this test. I don't think it's worth keeping this unit test for the effort. It's only for code that's passed through in the version upgrade from 2.4 to 2.5 anyway. Contributes to issue CURA-4243. --- tests/Settings/TestCuraContainerRegistry.py | 38 +-------------------- 1 file changed, 1 insertion(+), 37 deletions(-) diff --git a/tests/Settings/TestCuraContainerRegistry.py b/tests/Settings/TestCuraContainerRegistry.py index 1abd098338..e6dc6b99d8 100644 --- a/tests/Settings/TestCuraContainerRegistry.py +++ b/tests/Settings/TestCuraContainerRegistry.py @@ -145,40 +145,4 @@ def test_loadTypes(filename, output_class, container_registry): assert type(container) == output_class break else: - assert False #Container stack with specified ID was not loaded. - -## Tests whether loading a legacy file moves the upgraded file properly. -def test_loadLegacyFileRenamed(container_registry): - #Create a temporary file for the registry to load. - stacks_folder = os.path.join(os.path.dirname(os.path.abspath(__file__)), "stacks") - temp_file = os.path.join(stacks_folder, "temporary.stack.cfg") - temp_file_source = os.path.join(stacks_folder, "MachineLegacy.stack.cfg") - shutil.copyfile(temp_file_source, temp_file) - - #Mock some dependencies. - UM.Settings.ContainerStack.setContainerRegistry(container_registry) - Resources.getAllResourcesOfType = unittest.mock.MagicMock(return_value = [temp_file]) #Return a temporary file that we'll make for this test. - - def findContainers(container_type = 0, id = None): - if id == "MachineLegacy": - return None - - container = UM.Settings.ContainerRegistry._EmptyInstanceContainer(id) - container.getNextStack = unittest.mock.MagicMock() - return [container] - - old_find_containers = container_registry.findContainers - container_registry.findContainers = findContainers - - with unittest.mock.patch("cura.Settings.GlobalStack.GlobalStack.findContainer"): - container_registry.load() - - container_registry.findContainers = old_find_containers - - container_registry.saveAll() - print("all containers in registry", container_registry._containers) - assert not os.path.isfile(temp_file) - mime_type = container_registry.getMimeTypeForContainer(GlobalStack) - file_name = urllib.parse.quote_plus("MachineLegacy") + "." + mime_type.preferredSuffix - path = Resources.getStoragePath(Resources.ContainerStacks, file_name) - assert os.path.isfile(path) + assert False #Container stack with specified ID was not loaded. \ No newline at end of file