]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #19596: Set untestable tests in test_importlib to None
authorZachary Ware <zachary.ware@gmail.com>
Tue, 19 Nov 2013 03:44:38 +0000 (21:44 -0600)
committerZachary Ware <zachary.ware@gmail.com>
Tue, 19 Nov 2013 03:44:38 +0000 (21:44 -0600)
to avoid reporting success on empty tests.

Lib/test/test_importlib/builtin/test_finder.py
Lib/test/test_importlib/builtin/test_loader.py
Lib/test/test_importlib/extension/test_finder.py
Lib/test/test_importlib/extension/test_loader.py
Lib/test/test_importlib/frozen/test_finder.py
Lib/test/test_importlib/frozen/test_loader.py
Misc/NEWS

index 146538d891db52d8cdcee1606150bd64f75157fb..da0ef28589fcd9a8ea3b0a303c641490d0f3e183 100644 (file)
@@ -16,21 +16,11 @@ class FinderTests(abc.FinderTests):
             found = machinery.BuiltinImporter.find_module(builtin_util.NAME)
             self.assertTrue(found)
 
-    def test_package(self):
-        # Built-in modules cannot be a package.
-        pass
+    # Built-in modules cannot be a package.
+    test_package = test_package_in_package = test_package_over_module = None
 
-    def test_module_in_package(self):
-        # Built-in modules cannobt be in a package.
-        pass
-
-    def test_package_in_package(self):
-        # Built-in modules cannot be a package.
-        pass
-
-    def test_package_over_module(self):
-        # Built-in modules cannot be a package.
-        pass
+    # Built-in modules cannot be in a package.
+    test_module_in_package = None
 
     def test_failure(self):
         assert 'importlib' not in sys.builtin_module_names
index 8e186e71560e2ba0f5ee8f35491aa9b58c8b5c8f..12a79c6ba92a91c7be1a5a61728b54c5bbee0a07 100644 (file)
@@ -32,17 +32,11 @@ class LoaderTests(abc.LoaderTests):
             module = self.load_module(builtin_util.NAME)
             self.verify(module)
 
-    def test_package(self):
-        # Built-in modules cannot be a package.
-        pass
+    # Built-in modules cannot be a package.
+    test_package = test_lacking_parent = None
 
-    def test_lacking_parent(self):
-        # Built-in modules cannot be a package.
-        pass
-
-    def test_state_after_failure(self):
-        # Not way to force an imoprt failure.
-        pass
+    # No way to force an import failure.
+    test_state_after_failure = None
 
     def test_module_reuse(self):
         # Test that the same module is used in a reload.
index a63cfdb9b46db914303fd4de8f763f7bb21efe15..37f67727b0e7ad28cdb66687eac5c0ea45d69e75 100644 (file)
@@ -17,21 +17,14 @@ class FinderTests(abc.FinderTests):
     def test_module(self):
         self.assertTrue(self.find_module(util.NAME))
 
-    def test_package(self):
-        # No extension module as an __init__ available for testing.
-        pass
+    # No extension module as an __init__ available for testing.
+    test_package = test_package_in_package = None
 
-    def test_module_in_package(self):
-        # No extension module in a package available for testing.
-        pass
+    # No extension module in a package available for testing.
+    test_module_in_package = None
 
-    def test_package_in_package(self):
-        # No extension module as an __init__ available for testing.
-        pass
-
-    def test_package_over_module(self):
-        # Extension modules cannot be an __init__ for a package.
-        pass
+    # Extension modules cannot be an __init__ for a package.
+    test_package_over_module = None
 
     def test_failure(self):
         self.assertIsNone(self.find_module('asdfjkl;'))
index ca5af201c4d6c8ecfe0c14dbf570d106609e3640..e790675f5837e6893cb359157e714c3d6a92b3a5 100644 (file)
@@ -38,13 +38,11 @@ class LoaderTests(abc.LoaderTests):
             self.assertIsInstance(module.__loader__,
                                   machinery.ExtensionFileLoader)
 
-    def test_package(self):
-        # No extension module as __init__ available for testing.
-        pass
+    # No extension module as __init__ available for testing.
+    test_package = None
 
-    def test_lacking_parent(self):
-        # No extension module in a package available for testing.
-        pass
+    # No extension module in a package available for testing.
+    test_lacking_parent = None
 
     def test_module_reuse(self):
         with util.uncache(ext_util.NAME):
@@ -52,9 +50,8 @@ class LoaderTests(abc.LoaderTests):
             module2 = self.load_module(ext_util.NAME)
             self.assertIs(module1, module2)
 
-    def test_state_after_failure(self):
-        # No easy way to trigger a failure after a successful import.
-        pass
+    # No easy way to trigger a failure after a successful import.
+    test_state_after_failure = None
 
     def test_unloadable(self):
         name = 'asdfjkl;'
index fa0c2a037e92aec8ef487d41654c7736d6a5c65f..f0abe0e98953d39eb33776543f5d8f1c6e73aefc 100644 (file)
@@ -25,13 +25,11 @@ class FinderTests(abc.FinderTests):
         loader = self.find('__phello__.spam', ['__phello__'])
         self.assertTrue(hasattr(loader, 'load_module'))
 
-    def test_package_in_package(self):
-        # No frozen package within another package to test with.
-        pass
+    # No frozen package within another package to test with.
+    test_package_in_package = None
 
-    def test_package_over_module(self):
-        # No easy way to test.
-        pass
+    # No easy way to test.
+    test_package_over_module = None
 
     def test_failure(self):
         loader = self.find('<not real>')
index 4b8ec1555432b23ee8ffc745a7057cc7e464371a..f3a8bf67c78e0172519c857302632f3b621abc99 100644 (file)
@@ -65,9 +65,8 @@ class LoaderTests(abc.LoaderTests):
             self.assertEqual(repr(module),
                              "<module '__hello__' (frozen)>")
 
-    def test_state_after_failure(self):
-        # No way to trigger an error in a frozen module.
-        pass
+    # No way to trigger an error in a frozen module.
+    test_state_after_failure = None
 
     def test_unloadable(self):
         assert machinery.FrozenImporter.find_module('_not_real') is None
index 1ea0e47cee80437d8a351f0f864a523d0dfbbd38..897bbc23d7acb9f63c0ab700bfdad0eee469b57e 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -51,6 +51,9 @@ Library
 Tests
 -----
 
+- Issue #19596: Set untestable tests in test_importlib to None to avoid
+  reporting success on empty tests.
+
 - Issue #19440: Clean up test_capi by removing an unnecessary __future__
   import, converting from test_main to unittest.main, and running the
   _testcapi module tests within a unittest TestCase.