mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-08-10 07:15:03 -06:00
Use optional assert message instead of print
This commit is contained in:
parent
1f1ee7ff60
commit
6a36840793
1 changed files with 4 additions and 8 deletions
|
@ -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
|
||||
assert False, "Got an exception while reading the file {file_name}: {err}".format(file_name = file_name, err = str(e))
|
Loading…
Add table
Add a link
Reference in a new issue