|
13 | 13 | # just to make sure, it can be imported
|
14 | 14 | import support # @UnusedImport
|
15 | 15 |
|
16 |
| -from test import regrtest |
| 16 | +from test import libregrtest |
17 | 17 | from test import __path__ as test_path
|
18 | 18 |
|
19 | 19 | # path of the Stackless unittest directory
|
20 |
| -path = os.path.split(__file__)[0] |
| 20 | +path = os.path.abspath(os.path.split(__file__)[0]) |
21 | 21 | # add the stackless unittest dir to the package "test"
|
22 | 22 | test_path.insert(0, path)
|
23 | 23 |
|
24 |
| -# monkey patch: remove all standard tests |
25 |
| -del regrtest.STDTESTS[:] |
26 |
| - |
27 |
| - |
28 |
| -def main(): |
29 |
| - return regrtest.main(testdir=path) |
| 24 | +def main(tests=None, **kwargs): |
| 25 | + kwargs.setdefault("testdir", path) |
| 26 | + return libregrtest.main(tests=tests, **kwargs) |
| 27 | + |
| 28 | +def main_in_temp_cwd(tests=None, **kwargs): |
| 29 | + kwargs.setdefault("testdir", path) |
| 30 | + # unfortunately, libregrtest.main_in_temp_cwd() does not support |
| 31 | + # **kwargs. Monkey patch it |
| 32 | + mglobals = libregrtest.main_in_temp_cwd.__globals__ |
| 33 | + real_main = mglobals["main"] |
| 34 | + def main(): |
| 35 | + return real_main(tests, **kwargs) |
| 36 | + mglobals["main"] = main |
| 37 | + try: |
| 38 | + libregrtest.main_in_temp_cwd() |
| 39 | + finally: |
| 40 | + mglobals["main"] = real_main |
30 | 41 |
|
31 | 42 | if __name__ == '__main__':
|
32 |
| - main() |
| 43 | + main_in_temp_cwd() |
33 | 44 | import gc
|
34 | 45 | gc.set_debug(gc.DEBUG_UNCOLLECTABLE)
|
0 commit comments