blob: f9721c06d490925bb59de77b0f4a59378e3d8acb [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_import # execution bit, exception name differing, file name differing
10 between code and module (?)
Brett Cannon5e129db2009-08-27 23:52:35 +000011
12"""
13import importlib
14import sys
15from test import regrtest
16
17if __name__ == '__main__':
18 __builtins__.__import__ = importlib.__import__
19
20 exclude = ['--exclude',
21 'test_frozen', # Does not expect __loader__ attribute
22 'test_pkg', # Does not expect __loader__ attribute
23 'test_pydoc', # Does not expect __loader__ attribute
24 ]
Brett Cannon5e129db2009-08-27 23:52:35 +000025
Brett Cannon6cc83102009-08-30 08:30:35 +000026 # Switching on --exclude implies running all test but the ones listed, so
27 # only use it when one is not running an explicit test
28 if len(sys.argv) == 1:
29 # No programmatic way to specify tests to exclude
30 sys.argv.extend(exclude)
31
Brett Cannonce7d4cb2009-08-30 19:44:32 +000032 regrtest.main(quiet=True, verbose2=True)