[Python-checkins] r69171 - python/branches/py3k/Lib/importlib/test/__init__.py

brett.cannon python-checkins at python.org
Sun Feb 1 04:51:54 CET 2009


Author: brett.cannon
Date: Sun Feb  1 04:51:54 2009
New Revision: 69171

Log:
Do not execute the .pyc/.pyo files as well as the .py files.


Modified:
   python/branches/py3k/Lib/importlib/test/__init__.py

Modified: python/branches/py3k/Lib/importlib/test/__init__.py
==============================================================================
--- python/branches/py3k/Lib/importlib/test/__init__.py	(original)
+++ python/branches/py3k/Lib/importlib/test/__init__.py	Sun Feb  1 04:51:54 2009
@@ -9,7 +9,8 @@
         if name.startswith('.'):
             continue
         path = os.path.join(directory, name)
-        if os.path.isfile(path) and name.startswith('test_'):
+        if (os.path.isfile(path) and name.startswith('test_') and
+                name.endswith('.py')):
             submodule_name = os.path.splitext(name)[0]
             module_name = "{0}.{1}".format(package, submodule_name)
             __import__(module_name, level=0)
@@ -20,6 +21,8 @@
             __import__(package_name, level=0)
             package_tests = getattr(sys.modules[package_name], 'test_suite')()
             suite.addTest(package_tests)
+        else:
+            continue
     return suite
 
 


More information about the Python-checkins mailing list