| 1 |
|
| 2 |
""" |
| 3 |
PyPy Test runner interface |
| 4 |
-------------------------- |
| 5 |
|
| 6 |
Running pytest.py starts py.test, the testing tool |
| 7 |
we use in PyPy. It is distributed along with PyPy, |
| 8 |
but you may get more information about it at |
| 9 |
http://pytest.org/. |
| 10 |
|
| 11 |
Note that it makes no sense to run all tests at once. |
| 12 |
You need to pick a particular subdirectory and run |
| 13 |
|
| 14 |
cd pypy/.../test |
| 15 |
../../../pytest.py [options] |
| 16 |
|
| 17 |
For more information, use test_all.py -h. |
| 18 |
""" |
| 19 |
import sys, os |
| 20 |
import shutil |
| 21 |
|
| 22 |
|
| 23 |
if __name__ == '__main__': |
| 24 |
if len(sys.argv) == 1 and os.path.dirname(sys.argv[0]) in '.': |
| 25 |
print >> sys.stderr, __doc__ |
| 26 |
sys.exit(2) |
| 27 |
toplevel = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) |
| 28 |
|
| 29 |
sys.path.insert(0, toplevel) |
| 30 |
import pytest |
| 31 |
if sys.platform == 'win32': |
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
import ctypes |
| 36 |
winapi = ctypes.windll.kernel32 |
| 37 |
SetErrorMode = winapi.SetErrorMode |
| 38 |
SetErrorMode.argtypes=[ctypes.c_int] |
| 39 |
|
| 40 |
SEM_FAILCRITICALERRORS = 1 |
| 41 |
SEM_NOGPFAULTERRORBOX = 2 |
| 42 |
SEM_NOOPENFILEERRORBOX = 0x8000 |
| 43 |
flags = SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX | SEM_NOOPENFILEERRORBOX |
| 44 |
|
| 45 |
old_mode = SetErrorMode(flags) |
| 46 |
SetErrorMode(old_mode | flags) |
| 47 |
|
| 48 |
sys.exit(pytest.main()) |