[Kimchi-devel] [PATCH] Fix tests: restore the monkey patch after testing Paths

Mark Wu wudxw at linux.vnet.ibm.com
Wed Feb 26 05:16:01 UTC 2014


To test path vars,  we monkey patched the method get_prefix of
Paths, but not restored.  Because of it, the other test cases, like
test_plugin, fail to pass.  This patch restores the change on teardown.

Reported-by: Zhou Zheng Sheng <zhshzhou at linux.vnet.ibm.com>
Signed-off-by: Mark Wu <wudxw at linux.vnet.ibm.com>
---
 tests/test_config.py.in | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/tests/test_config.py.in b/tests/test_config.py.in
index 3b9ebdc..0400645 100644
--- a/tests/test_config.py.in
+++ b/tests/test_config.py.in
@@ -25,6 +25,17 @@ import unittest
 
 from kimchi.config import Paths, PluginPaths
 
+get_prefix = None
+
+
+def setUpModule():
+    global get_prefix
+    get_prefix = Paths.get_prefix
+
+
+def tearDownModule():
+    Paths.get_prefix = PluginPaths.get_prefix = get_prefix
+
 
 class ConfigTests(unittest.TestCase):
     def assertInstalledPath(self, actual, expected):
-- 
1.8.4.2




More information about the Kimchi-devel mailing list