summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorMichael Foord <fuzzyman@voidspace.org.uk>2009-09-13 19:07:03 (GMT)
committerMichael Foord <fuzzyman@voidspace.org.uk>2009-09-13 19:07:03 (GMT)
commite91ea56b307e026ba40140305d8f35f0e1c1143a (patch)
tree9fc09481fe1ff2b21bdfd56b25860a4e25a7cbd1 /Doc
parent6848d82a7c90ccf28ba0991129f99675e7b78e24 (diff)
downloadcpython-e91ea56b307e026ba40140305d8f35f0e1c1143a.zip
cpython-e91ea56b307e026ba40140305d8f35f0e1c1143a.tar.gz
cpython-e91ea56b307e026ba40140305d8f35f0e1c1143a.tar.bz2
Test discovery in unittest will only attempt to import modules that are importable; i.e. their names are valid Python identifiers. If an import fails during discovery this will be recorded as an error and test discovery will continue. Issue 6568.
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/unittest.rst7
1 files changed, 6 insertions, 1 deletions
diff --git a/Doc/library/unittest.rst b/Doc/library/unittest.rst
index 61c4308..f9e1725 100644
--- a/Doc/library/unittest.rst
+++ b/Doc/library/unittest.rst
@@ -1257,12 +1257,17 @@ Loading and running tests
Find and return all test modules from the specified start directory,
recursing into subdirectories to find them. Only test files that match
- *pattern* will be loaded. (Using shell style pattern matching.)
+ *pattern* will be loaded. (Using shell style pattern matching.) Only
+ module names that are importable (i.e. are valid Python identifiers) will
+ be loaded.
All test modules must be importable from the top level of the project. If
the start directory is not the top level directory then the top level
directory must be specified separately.
+ If importing a module fails, for example due to a syntax error, then this
+ will be recorded as a single error and discovery will continue.
+
If a test package name (directory with :file:`__init__.py`) matches the
pattern then the package will be checked for a ``load_tests``
function. If this exists then it will be called with *loader*, *tests*,