Remove redundant deserialize tests

They test Uranium code, not this module.

Contributes to issue CURA-3497.
This commit is contained in:
Ghostkeeper 2017-04-11 13:25:12 +02:00
parent 4bb217592f
commit b97ef58436
No known key found for this signature in database
GPG key ID: C5F96EE2BC0F7E75

View file

@ -253,126 +253,6 @@ def test_deserializeMoveDefinitionContainer(extruder_stack):
UM.Settings.ContainerStack._containerRegistry = None
## Tests whether materials are being read properly from an extruder stack.
@pytest.mark.parametrize("filename, material_id", [
("Left.extruder.cfg", "some_instance"),
("ExtruderLegacy.stack.cfg", "some_instance"),
("OnlyMaterial.extruder.cfg", "some_instance"),
("OnlyDefinition.extruder.cfg", "empty"),
("Complete.extruder.cfg", "some_material")
])
def test_deserializeMaterial(filename, material_id, container_registry, extruder_stack):
serialized = readStack(filename)
#Mock the loading of the instance containers.
extruder_stack.findContainer = findSomeContainers
original_container_registry = UM.Settings.ContainerStack._containerRegistry
UM.Settings.ContainerStack._containerRegistry = container_registry #Always has all profiles you ask of.
extruder_stack.deserialize(serialized)
assert extruder_stack.material.getId() == material_id
#Restore.
UM.Settings.ContainerStack._containerRegistry = original_container_registry
## Tests that when an extruder is loaded with an unknown instance, it raises an
# exception.
def test_deserializeMissingContainer(extruder_stack):
serialized = readStack("Left.extruder.cfg")
with pytest.raises(Exception):
extruder_stack.deserialize(serialized)
try:
extruder_stack.deserialize(serialized)
except Exception as e:
#Must be exactly Exception, not one of its subclasses, since that is what gets raised when a stack has an unknown container.
#That's why we can't use pytest.raises.
assert type(e) == Exception
## Tests whether qualities are being read properly from an extruder stack.
@pytest.mark.parametrize("filename, quality_id", [
("Left.extruder.cfg", "empty"),
("ExtruderLegacy.stack.cfg", "empty"),
("OnlyQuality.extruder.cfg", "some_instance"),
("Complete.extruder.cfg", "some_quality")
])
def test_deserializeQuality(filename, quality_id, container_registry, extruder_stack):
serialized = readStack(filename)
#Mock the loading of the instance containers.
extruder_stack.findContainer = findSomeContainers
original_container_registry = UM.Settings.ContainerStack._containerRegistry
UM.Settings.ContainerStack._containerRegistry = container_registry #Always has all profiles you ask of.
extruder_stack.deserialize(serialized)
assert extruder_stack.quality.getId() == quality_id
#Restore.
UM.Settings.ContainerStack._containerRegistry = original_container_registry
## Tests whether quality changes are being read properly from an extruder
# stack.
@pytest.mark.parametrize("filename, quality_changes_id", [
("Left.extruder.cfg", "empty"),
("ExtruderLegacy.stack.cfg", "empty"),
("OnlyQualityChanges.extruder.cfg", "some_instance"),
("Complete.extruder.cfg", "some_quality_changes")
])
def test_deserializeQualityChanges(filename, quality_changes_id, container_registry, extruder_stack):
serialized = readStack(filename)
#Mock the loading of the instance containers.
extruder_stack.findContainer = findSomeContainers
original_container_registry = UM.Settings.ContainerStack._containerRegistry
UM.Settings.ContainerStack._containerRegistry = container_registry #Always has all profiles you ask of.
extruder_stack.deserialize(serialized)
assert extruder_stack.qualityChanges.getId() == quality_changes_id
#Restore.
UM.Settings.ContainerStack._containerRegistry = original_container_registry
## Tests whether user changes are being read properly from an extruder stack.
@pytest.mark.parametrize("filename, user_changes_id", [
("Left.extruder.cfg", "empty"),
("ExtruderLegacy.stack.cfg", "empty"),
("OnlyUser.extruder.cfg", "some_instance"),
("Complete.extruder.cfg", "some_user_changes")
])
def test_deserializeUserChanges(filename, user_changes_id, container_registry, extruder_stack):
serialized = readStack(filename)
#Mock the loading of the instance containers.
extruder_stack.findContainer = findSomeContainers
original_container_registry = UM.Settings.ContainerStack._containerRegistry
UM.Settings.ContainerStack._containerRegistry = container_registry #Always has all profiles you ask of.
extruder_stack.deserialize(serialized)
assert extruder_stack.userChanges.getId() == user_changes_id
#Restore.
UM.Settings.ContainerStack._containerRegistry = original_container_registry
## Tests whether variants are being read properly from an extruder stack.
@pytest.mark.parametrize("filename, variant_id", [
("Left.extruder.cfg", "empty"),
("ExtruderLegacy.stack.cfg", "empty"),
("OnlyVariant.extruder.cfg", "some_instance"),
("Complete.extruder.cfg", "some_variant")
])
def test_deserializeVariant(filename, variant_id, container_registry, extruder_stack):
serialized = readStack(filename)
#Mock the loading of the instance containers.
extruder_stack.findContainer = findSomeContainers
original_container_registry = UM.Settings.ContainerStack._containerRegistry
UM.Settings.ContainerStack._containerRegistry = container_registry #Always has all profiles you ask of.
extruder_stack.deserialize(serialized)
assert extruder_stack.variant.getId() == variant_id
#Restore.
UM.Settings.ContainerStack._containerRegistry = original_container_registry
## Tests whether getProperty properly applies the stack-like behaviour on its
# containers.
def test_getPropertyFallThrough(extruder_stack):