Fail deserialize test if missing container doesn't raise an exception

If it raised an exception, we were checking whether it was the proper exception. But if it wasn't raising an exception we weren't checking anything. That's fixed now (and the header of the function is improved a bit too).

Contributes to issue CURA-3497.
This commit is contained in:
Ghostkeeper 2017-03-24 17:37:23 +01:00
parent 7913ff9bf2
commit 2936b9bf24
No known key found for this signature in database
GPG key ID: C5F96EE2BC0F7E75

View file

@ -283,8 +283,12 @@ def test_deserializeDefinition(filename, definition_id, container_registry, glob
#Restore. #Restore.
UM.Settings.ContainerStack._containerRegistry = original_container_registry UM.Settings.ContainerStack._containerRegistry = original_container_registry
def test_deserializeMissingContainer(container_registry, global_stack): ## Tests that when a global stack is loaded with an unknown instance, it raises
# an exception.
def test_deserializeMissingContainer(global_stack):
serialized = readStack("Global.global.cfg") serialized = readStack("Global.global.cfg")
with pytest.raises(Exception):
global_stack.deserialize(serialized)
try: try:
global_stack.deserialize(serialized) global_stack.deserialize(serialized)
except Exception as e: except Exception as e: