diff options
author | Jaime van Kessel <nallath@gmail.com> | 2020-10-09 15:02:47 +0300 |
---|---|---|
committer | Jaime van Kessel <nallath@gmail.com> | 2020-10-09 15:02:47 +0300 |
commit | 8f4dd3cb120c8c4d5e4c5a8301e1ee79960f48f8 (patch) | |
tree | 082a285ee86aafca8d6da95e5a93fed9248803cb /tests | |
parent | bfef61ad81b6702b6cdde3755da7733b51670f6c (diff) |
Made the asserts of the profile tests a bit more explicit
This makes it easier to read the test outcome, since it gives
much better hints what can / needs to be done to fix it.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Settings/TestProfiles.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/tests/Settings/TestProfiles.py b/tests/Settings/TestProfiles.py index 262b886640..5761f712c4 100644 --- a/tests/Settings/TestProfiles.py +++ b/tests/Settings/TestProfiles.py @@ -93,7 +93,7 @@ def test_validateQualityProfiles(file_name): # Fairly obvious, but all the types here should be of the type quality assert InstanceContainer.getConfigurationTypeFromSerialized(serialized) == "quality" # All quality profiles must be linked to an existing definition. - assert result["general"]["definition"] in all_definition_ids + assert result["general"]["definition"] in all_definition_ids, "The quality profile %s links to an unknown definition (%s)" % (file_name, result["general"]["definition"]) # We don't care what the value is, as long as it's there. assert result["metadata"].get("quality_type", None) is not None @@ -147,9 +147,10 @@ def test_validateVariantProfiles(file_name): serialized = data.read() result = InstanceContainer._readAndValidateSerialized(serialized) # Fairly obvious, but all the types here should be of the type quality - assert InstanceContainer.getConfigurationTypeFromSerialized(serialized) == "variant" + assert InstanceContainer.getConfigurationTypeFromSerialized(serialized) == "variant", "The profile %s should be of type variant, but isn't" % file_name + # All quality profiles must be linked to an existing definition. - assert result["general"]["definition"] in all_definition_ids + assert result["general"]["definition"] in all_definition_ids, "The profile %s isn't associated with a definition" % file_name # Check that all the values that we say something about are known. if "values" in result: @@ -159,8 +160,7 @@ def test_validateVariantProfiles(file_name): has_unknown_settings = not variant_setting_keys.issubset(all_setting_ids) if has_unknown_settings: - print("The following setting(s) %s are defined in the variant %s, but not in fdmprinter.def.json" % ([key for key in variant_setting_keys if key not in all_setting_ids], file_name)) - assert False + assert False, "The following setting(s) %s are defined in the variant %s, but not in fdmprinter.def.json" % ([key for key in variant_setting_keys if key not in all_setting_ids], file_name) except Exception as e: # File can't be read, header sections missing, whatever the case, this shouldn't happen! print("Got an Exception while reading the file [%s]: %s" % (file_name, e)) @@ -175,11 +175,11 @@ def test_versionUpToDate(file_name): assert "general" in parser assert "version" in parser["general"] - assert int(parser["general"]["version"]) == InstanceContainer.Version + assert int(parser["general"]["version"]) == InstanceContainer.Version, "The version of this profile is not up to date!" assert "metadata" in parser assert "setting_version" in parser["metadata"] - assert int(parser["metadata"]["setting_version"]) == CuraApplication.SettingVersion + assert int(parser["metadata"]["setting_version"]) == CuraApplication.SettingVersion, "The version of this profile is not up to date!" except Exception as e: # File can't be read, header sections missing, whatever the case, this shouldn't happen! print("Got an exception while reading the file {file_name}: {err}".format(file_name = file_name, err = str(e))) |