This repository was archived by the owner on Aug 2, 2019. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 88if __name__ == '__main__' : # if run as a script or by 'python -m pytest'
99 # we trigger the below "else" condition by the following import
1010 import pytest
11+ import sys
12+ if sys .platform == 'win32' :
13+ #Try to avoid opeing a dialog box if one of the tests causes a system error
14+ import ctypes
15+ winapi = ctypes .windll .kernel32
16+ SetErrorMode = winapi .SetErrorMode
17+ SetErrorMode .argtypes = [ctypes .c_int ]
18+
19+ SEM_FAILCRITICALERRORS = 1
20+ SEM_NOGPFAULTERRORBOX = 2
21+ SEM_NOOPENFILEERRORBOX = 0x8000
22+ flags = SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX | SEM_NOOPENFILEERRORBOX
23+ #Since there is no GetErrorMode, do a double Set
24+ old_mode = SetErrorMode (flags )
25+ SetErrorMode (old_mode | flags )
1126 raise SystemExit (pytest .main ())
1227
1328# else we are imported
You can’t perform that action at this time.
0 commit comments