summaryrefslogtreecommitdiffstats
path: root/Lib/importlib/test/regrtest.py
diff options
context:
space:
mode:
authorBrett Cannon <bcannon@gmail.com>2009-08-27 23:52:35 (GMT)
committerBrett Cannon <bcannon@gmail.com>2009-08-27 23:52:35 (GMT)
commit5e129dbc169363f286f8644edf8bf7c965869f72 (patch)
tree8b109f05531aed57ed7ee7566e18a3045f6f1906 /Lib/importlib/test/regrtest.py
parent5c26eaad23fcfea67384f472013aa61ac445b6b6 (diff)
downloadcpython-5e129dbc169363f286f8644edf8bf7c965869f72.zip
cpython-5e129dbc169363f286f8644edf8bf7c965869f72.tar.gz
cpython-5e129dbc169363f286f8644edf8bf7c965869f72.tar.bz2
Add a test file to importlib that runs regrtest using importlib.__import__.
The file must be run using runpy. Certain tests are currently excluded from being run as they have known failures based on golden value checks that fail for various reasons (typically because __loader__ is not expected to be set on modules). Running the tests with this file does discover some incompatibilites in importlib that will be fixed in the near future (as noted currently in the docstring).
Diffstat (limited to 'Lib/importlib/test/regrtest.py')
-rw-r--r--Lib/importlib/test/regrtest.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/Lib/importlib/test/regrtest.py b/Lib/importlib/test/regrtest.py
new file mode 100644
index 0000000..2988d74
--- /dev/null
+++ b/Lib/importlib/test/regrtest.py
@@ -0,0 +1,33 @@
+"""Run Python's standard test suite using importlib.__import__.
+
+XXX FAILING
+ test___all__ # tuple being given for fromlist (looks like interpreter is
+ doing it)
+ test_builtin # Wanting a TypeError for an integer name
+ test_import # execution bit, exception name differing, file name differing
+ between code and module (?)
+ test_importhooks # package not set in _gcd_import() but level > 0
+ test_pep3120 # Difference in exception
+ test_runpy # Importing sys.imp.eric raises AttributeError instead of
+ ImportError (as does any attempt to import a sub-module
+ from a non-package, e.g. tokenize.menotreal)
+
+"""
+import importlib
+import sys
+from test import regrtest
+
+if __name__ == '__main__':
+ __builtins__.__import__ = importlib.__import__
+
+ exclude = ['--exclude',
+ 'test_frozen', # Does not expect __loader__ attribute
+ 'test_pkg', # Does not expect __loader__ attribute
+ 'test_pydoc', # Does not expect __loader__ attribute
+ ]
+ # No programmatic way to specify tests to exclude
+ sys.argv.extend(exclude)
+
+ # verbose=True, quiet=False for all failure info
+ # tests=[...] for specific tests to run
+ regrtest.main(quiet=True)