Brett Cannon | 5e129db | 2009-08-27 23:52:35 +0000 | [diff] [blame] | 1 | """Run Python's standard test suite using importlib.__import__. |
| 2 | |
Brett Cannon | 12c3fc9 | 2009-08-30 08:39:57 +0000 | [diff] [blame^] | 3 | Tests known to fail because of assumptions that importlib (properly) |
| 4 | invalidates are automatically skipped if the entire test suite is run. |
| 5 | Otherwise all command-line options valid for test.regrtest are also valid for |
| 6 | this script. |
| 7 | |
Brett Cannon | 5e129db | 2009-08-27 23:52:35 +0000 | [diff] [blame] | 8 | XXX FAILING |
Brett Cannon | 5e129db | 2009-08-27 23:52:35 +0000 | [diff] [blame] | 9 | 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 | """ |
| 19 | import importlib |
| 20 | import sys |
| 21 | from test import regrtest |
| 22 | |
| 23 | if __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 Cannon | 5e129db | 2009-08-27 23:52:35 +0000 | [diff] [blame] | 31 | |
Brett Cannon | 6cc8310 | 2009-08-30 08:30:35 +0000 | [diff] [blame] | 32 | # 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 Cannon | 5e129db | 2009-08-27 23:52:35 +0000 | [diff] [blame] | 38 | regrtest.main(quiet=True) |