Browse Source

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.
Ghostkeeper 7 years ago
parent
commit
fab85616c7
1 changed files with 1 additions and 37 deletions
  1. 1 37
      tests/Settings/TestCuraContainerRegistry.py

+ 1 - 37
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.