Rev 3319: Simplify plugin.load_tests. in file:///v/home/vila/src/bzr/experimental/faster-selftest/
Vincent Ladeuil
v.ladeuil+lp at free.fr
Wed Mar 26 11:29:49 GMT 2008
At file:///v/home/vila/src/bzr/experimental/faster-selftest/
------------------------------------------------------------
revno: 3319
revision-id: v.ladeuil+lp at free.fr-20080326112940-leugmcpkbzox54c1
parent: v.ladeuil+lp at free.fr-20080326090634-1yv15m2m2e08uezt
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: filter-by-module-test-loader
timestamp: Wed 2008-03-26 12:29:40 +0100
message:
Simplify plugin.load_tests.
* bzrlib/tests/test_plugins.py:
(TestPlugins.test_no_load_tests_gives_None_for_load_tests)
(TestPlugins.test_load_tests_gives_load_tests_result): Make the
tests a bit more real.
modified:
bzrlib/plugin.py plugin.py-20050622060424-829b654519533d69
bzrlib/tests/test_plugins.py plugins.py-20050622075746-32002b55e5e943e9
-------------- next part --------------
=== modified file 'bzrlib/plugin.py'
--- a/bzrlib/plugin.py 2008-03-26 09:06:34 +0000
+++ b/bzrlib/plugin.py 2008-03-26 11:29:40 +0000
@@ -407,12 +407,9 @@
else:
return None
- def load_tests(self, standard_tests, loader):
+ def load_tests(self, loader):
"""Return the adapted plugin's test suite.
- :param standard_tests: The test suite as returned by the regular python
- loadTestsFromModule.
-
:param loader: The custom loader that should be used to load additional
tests.
@@ -421,7 +418,7 @@
ourselves.
"""
if getattr(self.module, 'load_tests', None) is not None:
- return self.module.load_tests(standard_tests, self.module, loader)
+ return loader.loadTestsFromModule(self.module)
else:
return None
=== modified file 'bzrlib/tests/test_plugins.py'
--- a/bzrlib/tests/test_plugins.py 2008-03-26 09:06:34 +0000
+++ b/bzrlib/tests/test_plugins.py 2008-03-26 11:29:40 +0000
@@ -32,7 +32,11 @@
import bzrlib.commands
import bzrlib.help
from bzrlib.symbol_versioning import one_three
-from bzrlib.tests import TestCase, TestCaseInTempDir
+from bzrlib.tests import (
+ TestCase,
+ TestCaseInTempDir,
+ TestUtil,
+ )
from bzrlib.osutils import pathjoin, abspath, normpath
@@ -284,17 +288,18 @@
def test_no_load_tests_gives_None_for_load_tests(self):
self.setup_plugin()
+ loader = TestUtil.TestLoader()
plugin = bzrlib.plugin.plugins()['plugin']
- self.assertEqual(None, plugin.load_tests('bar', 'bzr'))
+ self.assertEqual(None, plugin.load_tests(loader))
def test_load_tests_gives_load_tests_result(self):
source = """
def load_tests(standard_tests, module, loader):
return 'foo'"""
self.setup_plugin(source)
+ loader = TestUtil.TestLoader()
plugin = bzrlib.plugin.plugins()['plugin']
- # Note that
- self.assertEqual('foo', plugin.load_tests('bar', 'bzr'))
+ self.assertEqual('foo', plugin.load_tests(loader))
def test_no_version_info(self):
self.setup_plugin()
More information about the bazaar-commits
mailing list