Rev 3309: merge down-thread in file:///v/home/vila/src/bzr/experimental/faster-selftest/

Vincent Ladeuil v.ladeuil+lp at free.fr
Mon Mar 24 18:14:34 GMT 2008


At file:///v/home/vila/src/bzr/experimental/faster-selftest/

------------------------------------------------------------
revno: 3309
revision-id: v.ladeuil+lp at free.fr-20080324181430-91hpx1x34cfexygw
parent: v.ladeuil+lp at free.fr-20080324174247-ngn30tddzl2x3hyr
parent: v.ladeuil+lp at free.fr-20080324181042-15cfp1w770nf3pgb
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: filter-by-module-test-loader
timestamp: Mon 2008-03-24 19:14:30 +0100
message:
  merge down-thread
modified:
  bzrlib/tests/TestUtil.py       TestUtil.py-20050824080200-5f70140a2d938694
  bzrlib/tests/test_selftest.py  test_selftest.py-20051202044319-c110a115d8c0456a
    ------------------------------------------------------------
    revno: 3308.1.1
    revision-id: v.ladeuil+lp at free.fr-20080324181042-15cfp1w770nf3pgb
    parent: v.ladeuil+lp at free.fr-20080324174247-ngn30tddzl2x3hyr
    committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
    branch nick: test-suite-refactoring
    timestamp: Mon 2008-03-24 19:10:42 +0100
    message:
      Prepare TestLoader for specialization.
      
      * bzrlib/tests/test_selftest.py:
      (TestTestLoader): Add tests for loadTestsFromModuleName.
      
      * bzrlib/tests/TestUtil.py:
      (TestLoader.loadTestsFromModuleName): New method allowing
      specialization by daughter classes.
    modified:
      bzrlib/tests/TestUtil.py       TestUtil.py-20050824080200-5f70140a2d938694
      bzrlib/tests/test_selftest.py  test_selftest.py-20051202044319-c110a115d8c0456a
-------------- next part --------------
=== modified file 'bzrlib/tests/TestUtil.py'
--- a/bzrlib/tests/TestUtil.py	2008-01-07 16:47:46 +0000
+++ b/bzrlib/tests/TestUtil.py	2008-03-24 18:10:42 +0000
@@ -89,8 +89,14 @@
         """
         result = self.suiteClass()
         for name in names:
-            module = _load_module_by_name(name)
-            result.addTests(self.loadTestsFromModule(module))
+            result.addTests(self.loadTestsFromModuleName(name))
+        return result
+
+    def loadTestsFromModuleName(self, name):
+        result = self.suiteClass()
+        module = _load_module_by_name(name)
+
+        result.addTests(self.loadTestsFromModule(module))
         return result
 
     def loadTestsFromModule(self, module):

=== modified file 'bzrlib/tests/test_selftest.py'
--- a/bzrlib/tests/test_selftest.py	2008-03-24 17:36:52 +0000
+++ b/bzrlib/tests/test_selftest.py	2008-03-24 18:10:42 +0000
@@ -1915,6 +1915,16 @@
         module.__class__.load_tests = load_tests
         self.assertEqual(2, loader.loadTestsFromModule(module).countTestCases())
 
+    def test_load_tests_from_module_name_smoke_test(self):
+        loader = TestUtil.TestLoader()
+        suite = loader.loadTestsFromModuleName('bzrlib.tests.test_sampler')
+        self.assertEquals(['bzrlib.tests.test_sampler.DemoTest.test_nothing'],
+                          _test_ids(suite))
+
+    def test_load_tests_from_module_name_with_bougs_module_name(self):
+        loader = TestUtil.TestLoader()
+        self.assertRaises(ImportError, loader.loadTestsFromModuleName, 'bogus')
+
 
 class TestTestIdList(tests.TestCase):
 



More information about the bazaar-commits mailing list