blob: 17e7f4ef79df06d4756c7aede1300be2bf6f6cd2 [file] [log] [blame]
Brett Cannon5e129db2009-08-27 23:52:35 +00001"""Run Python's standard test suite using importlib.__import__.
2
Brett Cannon12c3fc92009-08-30 08:39:57 +00003Tests known to fail because of assumptions that importlib (properly)
4invalidates are automatically skipped if the entire test suite is run.
5Otherwise all command-line options valid for test.regrtest are also valid for
6this script.
7
Brett Cannon5e129db2009-08-27 23:52:35 +00008XXX FAILING
Brett Cannon5e129db2009-08-27 23:52:35 +00009 test_builtin # Wanting a TypeError for an integer name
10 test_import # execution bit, exception name differing, file name differing
11 between code and module (?)
12 test_importhooks # package not set in _gcd_import() but level > 0
13 test_pep3120 # Difference in exception
14 test_runpy # Importing sys.imp.eric raises AttributeError instead of
15 ImportError (as does any attempt to import a sub-module
16 from a non-package, e.g. tokenize.menotreal)
17
18"""
19import importlib
20import sys
21from test import regrtest
22
23if __name__ == '__main__':
24 __builtins__.__import__ = importlib.__import__
25
26 exclude = ['--exclude',
27 'test_frozen', # Does not expect __loader__ attribute
28 'test_pkg', # Does not expect __loader__ attribute
29 'test_pydoc', # Does not expect __loader__ attribute
30 ]
Brett Cannon5e129db2009-08-27 23:52:35 +000031
Brett Cannon6cc83102009-08-30 08:30:35 +000032 # Switching on --exclude implies running all test but the ones listed, so
33 # only use it when one is not running an explicit test
34 if len(sys.argv) == 1:
35 # No programmatic way to specify tests to exclude
36 sys.argv.extend(exclude)
37
Brett Cannon5e129db2009-08-27 23:52:35 +000038 regrtest.main(quiet=True)