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

Zhou Zheng Sheng zhshzhou at linux.vnet.ibm.com
Wed Feb 26 05:50:11 UTC 2014


Reviewed-by: Zhou Zheng Sheng <zhshzhou at linux.vnet.ibm.com>

To reproduce the problem. CD to tests/, and run
 ./run_tests.sh test_config test_plugin

After the patch, the problem is gone.

on 2014/02/26 13:16, Mark Wu wrote:
> 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):
> 


-- 
Thanks and best regards!

Zhou Zheng Sheng / 周征晟
E-mail: zhshzhou at linux.vnet.ibm.com
Telephone: 86-10-82454397




More information about the Kimchi-devel mailing list