summaryrefslogtreecommitdiffstats
path: root/Lib/importlib/test/__init__.py
diff options
context:
space:
mode:
authorBrett Cannon <bcannon@gmail.com>2009-01-18 00:36:22 (GMT)
committerBrett Cannon <bcannon@gmail.com>2009-01-18 00:36:22 (GMT)
commit7044d6b848e39586f67719540fce58ed157bce32 (patch)
treefc05ddb16469b5307c5427ce44369c933ae33a14 /Lib/importlib/test/__init__.py
parentd3fb4bb450fa749ce3e5ca0e5ae17c9d2ad4236d (diff)
downloadcpython-7044d6b848e39586f67719540fce58ed157bce32.zip
cpython-7044d6b848e39586f67719540fce58ed157bce32.tar.gz
cpython-7044d6b848e39586f67719540fce58ed157bce32.tar.bz2
Skip over any file or folder that starts with a dot (e.g. .svn).
Diffstat (limited to 'Lib/importlib/test/__init__.py')
-rw-r--r--Lib/importlib/test/__init__.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/importlib/test/__init__.py b/Lib/importlib/test/__init__.py
index 6492707..f130d9f 100644
--- a/Lib/importlib/test/__init__.py
+++ b/Lib/importlib/test/__init__.py
@@ -6,6 +6,8 @@ import unittest
def test_suite(package=__package__, directory=os.path.dirname(__file__)):
suite = unittest.TestSuite()
for name in os.listdir(directory):
+ if name.startswith('.'):
+ continue
path = os.path.join(directory, name)
if os.path.isfile(path) and name.startswith('test_'):
submodule_name = os.path.splitext(name)[0]
@@ -15,6 +17,7 @@ def test_suite(package=__package__, directory=os.path.dirname(__file__)):
suite.addTest(module_tests)
elif os.path.isdir(path):
package_name = "{0}.{1}".format(package, name)
+ print(package_name)
__import__(package_name, level=0)
package_tests = getattr(sys.modules[package_name], 'test_suite')()
suite.addTest(package_tests)