Brett Cannon | 5e129db | 2009-08-27 23:52:35 +0000 | [diff] [blame] | 1 | """Run Python's standard test suite using importlib.__import__. |
| 2 | |
| 3 | XXX FAILING |
| 4 | test___all__ # tuple being given for fromlist (looks like interpreter is |
| 5 | doing it) |
| 6 | test_builtin # Wanting a TypeError for an integer name |
| 7 | test_import # execution bit, exception name differing, file name differing |
| 8 | between code and module (?) |
| 9 | test_importhooks # package not set in _gcd_import() but level > 0 |
| 10 | test_pep3120 # Difference in exception |
| 11 | test_runpy # Importing sys.imp.eric raises AttributeError instead of |
| 12 | ImportError (as does any attempt to import a sub-module |
| 13 | from a non-package, e.g. tokenize.menotreal) |
| 14 | |
| 15 | """ |
| 16 | import importlib |
| 17 | import sys |
| 18 | from test import regrtest |
| 19 | |
| 20 | if __name__ == '__main__': |
| 21 | __builtins__.__import__ = importlib.__import__ |
| 22 | |
| 23 | exclude = ['--exclude', |
| 24 | 'test_frozen', # Does not expect __loader__ attribute |
| 25 | 'test_pkg', # Does not expect __loader__ attribute |
| 26 | 'test_pydoc', # Does not expect __loader__ attribute |
| 27 | ] |
Brett Cannon | 5e129db | 2009-08-27 23:52:35 +0000 | [diff] [blame] | 28 | |
Brett Cannon | 6cc8310 | 2009-08-30 08:30:35 +0000 | [diff] [blame^] | 29 | # Switching on --exclude implies running all test but the ones listed, so |
| 30 | # only use it when one is not running an explicit test |
| 31 | if len(sys.argv) == 1: |
| 32 | # No programmatic way to specify tests to exclude |
| 33 | sys.argv.extend(exclude) |
| 34 | |
Brett Cannon | 5e129db | 2009-08-27 23:52:35 +0000 | [diff] [blame] | 35 | regrtest.main(quiet=True) |