Fix tests
This commit is contained in:
parent
42fa60fd94
commit
d891d6b5dd
1 changed files with 117 additions and 0 deletions
117
fix-tests.patch
Normal file
117
fix-tests.patch
Normal file
|
|
@ -0,0 +1,117 @@
|
|||
From b1f054ffbf85eaa403e2158c2d7548bcc5491e73 Mon Sep 17 00:00:00 2001
|
||||
From: Lipu Fei <lipu.fei815@gmail.com>
|
||||
Date: Wed, 11 Jul 2018 12:20:57 +0200
|
||||
Subject: [PATCH] Fix unit tests
|
||||
|
||||
---
|
||||
.../ContainerTestPlugin.py | 8 +++++++-
|
||||
tests/Settings/TestContainerRegistry.py | 14 +++++++++-----
|
||||
tests/Settings/TestContainerStack.py | 19 +++++++++----------
|
||||
3 files changed, 25 insertions(+), 16 deletions(-)
|
||||
|
||||
diff --git a/tests/Settings/ContainerTestPlugin/ContainerTestPlugin.py b/tests/Settings/ContainerTestPlugin/ContainerTestPlugin.py
|
||||
index 71e5561..5afb021 100644
|
||||
--- a/tests/Settings/ContainerTestPlugin/ContainerTestPlugin.py
|
||||
+++ b/tests/Settings/ContainerTestPlugin/ContainerTestPlugin.py
|
||||
@@ -1,7 +1,7 @@
|
||||
# Copyright (c) 2017 Ultimaker B.V.
|
||||
# Uranium is released under the terms of the LGPLv3 or higher.
|
||||
|
||||
-from typing import Optional
|
||||
+from typing import Any, Optional
|
||||
import uuid
|
||||
|
||||
from UM.PluginObject import PluginObject
|
||||
@@ -63,6 +63,9 @@ class ContainerTestPlugin(ContainerInterface, PluginObject):
|
||||
def isReadOnly(self):
|
||||
return False
|
||||
|
||||
+ def getAllKeys(self):
|
||||
+ pass
|
||||
+
|
||||
## Get the value of a property of a container item.
|
||||
#
|
||||
# Since this test container cannot contain any items, it always returns
|
||||
@@ -72,6 +75,9 @@ class ContainerTestPlugin(ContainerInterface, PluginObject):
|
||||
def getProperty(self, key, property_name, context = None):
|
||||
pass
|
||||
|
||||
+ def setProperty(self, key: str, property_name: str, property_value: Any, container: "ContainerInterface" = None, set_from_cache: bool = False) -> None:
|
||||
+ pass
|
||||
+
|
||||
def hasProperty(self, key, property_name):
|
||||
pass
|
||||
|
||||
diff --git a/tests/Settings/TestContainerRegistry.py b/tests/Settings/TestContainerRegistry.py
|
||||
index bd3f666..1db4578 100644
|
||||
--- a/tests/Settings/TestContainerRegistry.py
|
||||
+++ b/tests/Settings/TestContainerRegistry.py
|
||||
@@ -1,10 +1,11 @@
|
||||
# Copyright (c) 2017 Ultimaker B.V.
|
||||
# Uranium is released under the terms of the LGPLv3 or higher.
|
||||
|
||||
-import os.path
|
||||
-import pytest
|
||||
+import os
|
||||
from typing import Optional
|
||||
|
||||
+import pytest
|
||||
+
|
||||
import UM.PluginObject
|
||||
from UM.Resources import Resources
|
||||
from UM.Settings.DefinitionContainer import DefinitionContainer
|
||||
@@ -75,9 +76,12 @@ class MockContainer(ContainerInterface, UM.PluginObject.PluginObject):
|
||||
def setPath(self, path):
|
||||
pass
|
||||
|
||||
- ## Gets the value of a property of a container item.
|
||||
- #
|
||||
- # This method is not implemented in the mock container.
|
||||
+ def getAllKeys(self):
|
||||
+ pass
|
||||
+
|
||||
+ def setProperty(self, key, property_name, property_value, container = None, set_from_cache = False):
|
||||
+ pass
|
||||
+
|
||||
def getProperty(self, key, property_name, context = None):
|
||||
raise NotImplementedError()
|
||||
|
||||
diff --git a/tests/Settings/TestContainerStack.py b/tests/Settings/TestContainerStack.py
|
||||
index a07b647..9bf918c 100644
|
||||
--- a/tests/Settings/TestContainerStack.py
|
||||
+++ b/tests/Settings/TestContainerStack.py
|
||||
@@ -38,6 +38,9 @@ class MockContainer(ContainerInterface):
|
||||
def getName(self):
|
||||
return "Fred"
|
||||
|
||||
+ def getAllKeys(self):
|
||||
+ pass
|
||||
+
|
||||
## Get whether the container item is stored on a read only location in the filesystem.
|
||||
#
|
||||
# \return Always returns False
|
||||
@@ -52,9 +55,6 @@ class MockContainer(ContainerInterface):
|
||||
def setPath(self, path):
|
||||
pass
|
||||
|
||||
- ## Returns the metadata dictionary.
|
||||
- #
|
||||
- # \return A dictionary containing metadata for this container stack.
|
||||
def getMetaData(self):
|
||||
return self._metadata
|
||||
|
||||
@@ -69,11 +69,9 @@ class MockContainer(ContainerInterface):
|
||||
return self._metadata["entry"]
|
||||
return default
|
||||
|
||||
- ## Gets the value of a container item property.
|
||||
- #
|
||||
- # If the key doesn't exist, returns None.
|
||||
- #
|
||||
- # \param key The key of the item to get.
|
||||
+ def setProperty(self, key, property_name, property_value, container = None, set_from_cache = False):
|
||||
+ pass
|
||||
+
|
||||
def getProperty(self, key, property_name, context = None):
|
||||
if key in self.items:
|
||||
return self.items[key]
|
||||
Loading…
Add table
Add a link
Reference in a new issue