From 2936b9bf24f78a842b9aceef1c8088782736a7ff Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 24 Mar 2017 17:37:23 +0100 Subject: [PATCH] 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. --- tests/Settings/TestGlobalStack.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/Settings/TestGlobalStack.py b/tests/Settings/TestGlobalStack.py index 54cbbee5fd..ef60e315af 100644 --- a/tests/Settings/TestGlobalStack.py +++ b/tests/Settings/TestGlobalStack.py @@ -283,8 +283,12 @@ def test_deserializeDefinition(filename, definition_id, container_registry, glob #Restore. 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") + with pytest.raises(Exception): + global_stack.deserialize(serialized) try: global_stack.deserialize(serialized) except Exception as e: