diff options
author | Jaime van Kessel <nallath@gmail.com> | 2022-07-08 11:24:23 +0300 |
---|---|---|
committer | Jaime van Kessel <nallath@gmail.com> | 2022-07-08 11:24:23 +0300 |
commit | 6a36840793078bd26228ae6e9545fcaaed1c14b1 (patch) | |
tree | 6567f15a06deb32d878790ba0c57259153c7e250 /tests | |
parent | 1f1ee7ff60ccd53c45efeb67c331fda5e0cc7664 (diff) |
Use optional assert message instead of print
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Settings/TestProfiles.py | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/tests/Settings/TestProfiles.py b/tests/Settings/TestProfiles.py index 5761f712c4..2da455d16d 100644 --- a/tests/Settings/TestProfiles.py +++ b/tests/Settings/TestProfiles.py @@ -106,13 +106,11 @@ def test_validateQualityProfiles(file_name): has_unknown_settings = not quality_setting_keys.issubset(all_setting_ids) if has_unknown_settings: - print("The following setting(s) %s are defined in the quality %s, but not in fdmprinter.def.json" % ([key for key in quality_setting_keys if key not in all_setting_ids], file_name)) - assert False + assert False, "The following setting(s) %s are defined in the quality %s, but not in fdmprinter.def.json" % ([key for key in quality_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)) - assert False + assert False, f"Got an Exception while reading the file [{file_name}]: {e}" @pytest.mark.parametrize("file_name", intent_filepaths) @@ -163,8 +161,7 @@ def test_validateVariantProfiles(file_name): 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)) - assert False + assert False, "Got an exception while reading the file {file_name}: {err}".format(file_name = file_name, err = str(e)) @pytest.mark.parametrize("file_name", quality_filepaths + variant_filepaths + intent_filepaths) @@ -182,5 +179,4 @@ def test_versionUpToDate(file_name): 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))) - assert False
\ No newline at end of file + assert False, "Got an exception while reading the file {file_name}: {err}".format(file_name = file_name, err = str(e))
\ No newline at end of file |