summaryrefslogtreecommitdiffstats
path: root/Lib/test/regrtest.py
diff options
context:
space:
mode:
authorThomas Wouters <thomas@python.org>2006-04-27 23:13:20 (GMT)
committerThomas Wouters <thomas@python.org>2006-04-27 23:13:20 (GMT)
commit9df4e6f6735af274813cf1b611ee1a342955ad63 (patch)
treec0ab6329dd61fc03a46932435828210b3d0d3db8 /Lib/test/regrtest.py
parent2c1e63f8a48bf0f530a922219e85443c4e12882d (diff)
downloadcpython-9df4e6f6735af274813cf1b611ee1a342955ad63.zip
cpython-9df4e6f6735af274813cf1b611ee1a342955ad63.tar.gz
cpython-9df4e6f6735af274813cf1b611ee1a342955ad63.tar.bz2
- Add new Warning class, ImportWarning
- Warn-raise ImportWarning when importing would have picked up a directory as package, if only it'd had an __init__.py. This swaps two tests (for case-ness and __init__-ness), but case-test is not really more expensive, and it's not in a speed-critical section. - Test for the new warning by importing a common non-package directory on sys.path: site-packages - In regrtest.py, silence warnings generated by the build-environment because Modules/ (which is added to sys.path for Setup-created modules) has 'zlib' and '_ctypes' directories without __init__.py's.
Diffstat (limited to 'Lib/test/regrtest.py')
-rwxr-xr-xLib/test/regrtest.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py
index 7db94aa..be06d9d 100755
--- a/Lib/test/regrtest.py
+++ b/Lib/test/regrtest.py
@@ -138,6 +138,12 @@ if sys.maxint > 0x7fffffff:
warnings.filterwarnings("ignore", "hex/oct constants", FutureWarning,
"<string>")
+# Ignore ImportWarnings that only occur in the source tree,
+# (because of modules with the same name as source-directories in Modules/)
+for mod in ("ctypes", "gzip", "test.test_zipimport", "test.test_zlib"):
+ warnings.filterwarnings(module=".*%s$" % (mod,),
+ action="ignore", category=ImportWarning)
+
# MacOSX (a.k.a. Darwin) has a default stack size that is too small
# for deeply recursive regular expressions. We see this as crashes in
# the Python test suite when running test_re.py and test_sre.py. The