Re: [PATCH 7/7] tests: Removed setUp/tearDown code in python tests
- From: Víctor M. Jáquez L. <vjaquez igalia com>
- To: Simón Pena <spenap gmail com>
- Cc: grilo-list gnome org
- Subject: Re: [PATCH 7/7] tests: Removed setUp/tearDown code in python tests
- Date: Wed, 29 Sep 2010 13:23:24 +0200
On Tue, Sep 28, 2010 at 06:28:32PM +0200, Simón Pena wrote:
> ---
> tests/python/test_metadata_source.py | 9 ++-------
> tests/python/test_plugin.py | 9 ++-------
> tests/python/test_registry.py | 22 ++++++++++++++--------
> 3 files changed, 18 insertions(+), 22 deletions(-)
Why did you submitted this patch?
I guess it is because the current register is not capable of plugins reloading
on-the-fly, but it isn't stated in the log message. In that way we would
revert it when the registry would get updated.
vmjl
>
> diff --git a/tests/python/test_metadata_source.py b/tests/python/test_metadata_source.py
> index 92482e7..27cf58a 100644
> --- a/tests/python/test_metadata_source.py
> +++ b/tests/python/test_metadata_source.py
> @@ -13,7 +13,8 @@ class TestMetadataSource(unittest.TestCase):
> METADATA_FLAGS = Grl.MetadataResolutionFlags(Grl.MetadataResolutionFlags.FULL |
> Grl.MetadataResolutionFlags.IDLE_RELAY)
>
> - def setUp(self):
> + def __init__(self, method_name):
> + super(TestMetadataSource, self).__init__(method_name)
> Grl.init([])
> self.registry = Grl.PluginRegistry.get_default()
> self.registry.load_all()
> @@ -23,12 +24,6 @@ class TestMetadataSource(unittest.TestCase):
> if sources:
> self.metadata_source = sources[0]
>
> - def tearDown(self):
> - self.metadata_source = None
> - for source in self.registry.get_sources(False):
> - self.registry.unload(source.get_id())
> - self.registry.unregister_source(source)
> -
> def test_supported_ops(self):
> ops = self.metadata_source.supported_operations()
> self.assertTrue(ops)
> diff --git a/tests/python/test_plugin.py b/tests/python/test_plugin.py
> index 1af54cb..9ebc6c7 100644
> --- a/tests/python/test_plugin.py
> +++ b/tests/python/test_plugin.py
> @@ -11,7 +11,8 @@ class TestMediaPlugin(unittest.TestCase):
>
> NONEXISTING_KEY = 'nonexisting_key'
>
> - def setUp(self):
> + def __init__(self, method_name):
> + super(TestMediaPlugin, self).__init__(method_name)
> Grl.init([])
> self.registry = Grl.PluginRegistry.get_default()
> self.registry.load_all()
> @@ -19,12 +20,6 @@ class TestMediaPlugin(unittest.TestCase):
> if sources:
> self.plugin = sources[0]
>
> - def tearDown(self):
> - self.plugin = None
> - for source in self.registry.get_sources(False):
> - self.registry.unload(source.get_id())
> - self.registry.unregister_source(source)
> -
> def test_get_name(self):
> name = self.plugin.get_name()
> self.assertTrue(name)
> diff --git a/tests/python/test_registry.py b/tests/python/test_registry.py
> index b7b85c1..06b072f 100644
> --- a/tests/python/test_registry.py
> +++ b/tests/python/test_registry.py
> @@ -22,18 +22,24 @@ class TestPluginRegistry(unittest.TestCase):
>
> NONEXISTING_SOURCE = 'NON_EXISTING_SOURCE'
>
> - def setUp(self):
> + def __init__(self, method_name):
> + super(TestPluginRegistry, self).__init__(method_name)
> Grl.init([])
> self.registry = Grl.PluginRegistry.get_default()
> - plugin_dir = os.listdir(util.GRL_PLUGIN_PATH)
> - if plugin_dir:
> - self.EXISTING_LIBRARY_PATH = os.path.join(util.GRL_PLUGIN_PATH,
> - plugin_dir[0])
> + plugin_paths = util.GRL_PLUGIN_PATH.split(':')
> + for path in plugin_paths:
> + if path:
> + entries = os.listdir(path)
> + self.EXISTING_LIBRARY_PATH = os.path.join(path,
> + entries[0])
> + break
> + print self.EXISTING_LIBRARY_PATH
> +
> + def setUp(self):
> + pass
>
> def tearDown(self):
> - for source in self.registry.get_sources(False):
> - self.registry.unload(source.get_id())
> - self.registry.unregister_source(source)
> + pass
>
> def test_get_default_not_null(self):
> registry = Grl.PluginRegistry.get_default()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]