mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-12 22:49:01 +08:00
Add test for deserializing with a missing container
A container is missing in the registry, so it should raise an exception. Contributes to issue CURA-3497.
This commit is contained in:
parent
69c53dcd73
commit
7913ff9bf2
@ -135,6 +135,19 @@ def test_deserializeMaterial(filename, material_id, container_registry, extruder
|
|||||||
#Restore.
|
#Restore.
|
||||||
UM.Settings.ContainerStack._containerRegistry = original_container_registry
|
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.
|
## Tests whether qualities are being read properly from an extruder stack.
|
||||||
@pytest.mark.parametrize("filename, quality_id", [
|
@pytest.mark.parametrize("filename, quality_id", [
|
||||||
("Left.extruder.cfg", "empty"),
|
("Left.extruder.cfg", "empty"),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user