[Kimchi-devel] [PATCH V6 8/8] skip plugins test, when sample plugin is not enabled

Zhou Zheng Sheng zhshzhou at linux.vnet.ibm.com
Wed Jun 11 06:19:15 UTC 2014


I notice that there is a tab between "test," and "when" in the email title.

One more comment bellow.

on 2014/06/10 18:15, shaohef at linux.vnet.ibm.com wrote:
> From: ShaoHe Feng <shaohef at linux.vnet.ibm.com>
> 
> The plugins tests base on the sample plugin.
> So we should skip the tests when disable sample plugin
> 
> Signed-off-by: ShaoHe Feng <shaohef at linux.vnet.ibm.com>
> ---
>  tests/test_plugin.py | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/test_plugin.py b/tests/test_plugin.py
> index 7773a0e..d862753 100644
> --- a/tests/test_plugin.py
> +++ b/tests/test_plugin.py
> @@ -27,6 +27,7 @@
> 
>  import kimchi.mockmodel
>  import kimchi.server
> +from kimchi.utils import get_enabled_plugins
>  import utils
> 
> 
> @@ -39,7 +40,6 @@
> 
>  def setUpModule():
>      global test_server, model, host, port, ssl_port
> -
>      model = kimchi.mockmodel.MockModel('/tmp/obj-store-test')
>      host = '127.0.0.1'
>      port = utils.get_free_port('http')
> @@ -53,6 +53,9 @@ def tearDownModule():
>      os.unlink('/tmp/obj-store-test')
> 
> 
> + at unittest.skipUnless(
> +     'sample' in [plugin for (plugin, config) in get_enabled_plugins()],
> +     'sample plugin is not enabled, skip this test!')

The parenthesis is not necessary. Just

  'sample' in [plugin for plugin, _config in get_enabled_plugins()]

is OK. This is very trivial. If you don't bother to submit a new
version, I can still accept this version.

>  class PluginTests(unittest.TestCase):
> 
>      def setUp(self):
> 


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




More information about the Kimchi-devel mailing list