Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Ultimaker/Cura.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaime van Kessel <nallath@gmail.com>2020-06-19 16:34:13 +0300
committerJaime van Kessel <nallath@gmail.com>2020-06-19 16:34:13 +0300
commitcb657ac45ae74815d5caa9774b35a5194629acc7 (patch)
tree8a9364251fefdda9fed24c0df6f4474d9cd6218f /tests/Settings
parentea0c8ff9bc2b0a51dc098170d33ff4648f97defd (diff)
Some minor stylechanges in tests
Diffstat (limited to 'tests/Settings')
-rw-r--r--tests/Settings/TestDefinitionContainer.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/tests/Settings/TestDefinitionContainer.py b/tests/Settings/TestDefinitionContainer.py
index 8622db26ee..d434066d10 100644
--- a/tests/Settings/TestDefinitionContainer.py
+++ b/tests/Settings/TestDefinitionContainer.py
@@ -12,7 +12,7 @@ from unittest.mock import patch, MagicMock
import UM.Settings.ContainerRegistry #To create empty instance containers.
import UM.Settings.ContainerStack #To set the container registry the container stacks use.
from UM.Settings.DefinitionContainer import DefinitionContainer #To check against the class of DefinitionContainer.
-
+from UM.VersionUpgradeManager import FilesDataUpdateResult
from UM.Resources import Resources
Resources.addSearchPath(os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..", "resources")))
@@ -36,6 +36,7 @@ def definition_container():
assert result.getId() == uid
return result
+
@pytest.mark.parametrize("file_path", definition_filepaths)
def test_definitionIds(file_path):
"""
@@ -45,6 +46,7 @@ def test_definitionIds(file_path):
definition_id = os.path.basename(file_path).split(".")[0]
assert " " not in definition_id # Definition IDs are not allowed to have spaces.
+
@pytest.mark.parametrize("file_path", definition_filepaths)
def test_noCategory(file_path):
"""
@@ -57,6 +59,7 @@ def test_noCategory(file_path):
metadata = DefinitionContainer.deserializeMetadata(json, "test_container_id")
assert "category" not in metadata[0]
+
@pytest.mark.parametrize("file_path", machine_filepaths)
def test_validateMachineDefinitionContainer(file_path, definition_container):
"""Tests all definition containers"""
@@ -65,13 +68,12 @@ def test_validateMachineDefinitionContainer(file_path, definition_container):
if file_name == "fdmprinter.def.json" or file_name == "fdmextruder.def.json":
return # Stop checking, these are root files.
- from UM.VersionUpgradeManager import FilesDataUpdateResult
-
mocked_vum = MagicMock()
mocked_vum.updateFilesData = lambda ct, v, fdl, fnl: FilesDataUpdateResult(ct, v, fdl, fnl)
with patch("UM.VersionUpgradeManager.VersionUpgradeManager.getInstance", MagicMock(return_value = mocked_vum)):
assertIsDefinitionValid(definition_container, file_path)
+
def assertIsDefinitionValid(definition_container, file_path):
with open(file_path, encoding = "utf-8") as data:
json = data.read()
@@ -86,6 +88,7 @@ def assertIsDefinitionValid(definition_container, file_path):
if "platform_texture" in metadata[0]:
assert metadata[0]["platform_texture"] in all_images
+
@pytest.mark.parametrize("file_path", definition_filepaths)
def test_validateOverridingDefaultValue(file_path: str):
"""Tests whether setting values are not being hidden by parent containers.
@@ -189,7 +192,9 @@ def test_noId(file_path: str):
@pytest.mark.parametrize("file_path", extruder_filepaths)
def test_extruderMatch(file_path: str):
- """Verifies that extruders say that they work on the same extruder_nr as what is listed in their machine definition."""
+ """
+ Verifies that extruders say that they work on the same extruder_nr as what is listed in their machine definition.
+ """
extruder_id = os.path.basename(file_path).split(".")[0]
with open(file_path, encoding = "utf-8") as f: