Skip to content
This repository was archived by the owner on Feb 13, 2025. It is now read-only.

Commit d70d671

Browse files
author
Anselm Kruis
committed
Issue #133: Fix the Stackless test suite
Adapt Stackless/unittests/runAll.py to issue python#25220.
1 parent 1dd094a commit d70d671

File tree

1 file changed

+20
-9
lines changed

1 file changed

+20
-9
lines changed

Stackless/unittests/runAll.py

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,33 @@
1313
# just to make sure, it can be imported
1414
import support # @UnusedImport
1515

16-
from test import regrtest
16+
from test import libregrtest
1717
from test import __path__ as test_path
1818

1919
# path of the Stackless unittest directory
20-
path = os.path.split(__file__)[0]
20+
path = os.path.abspath(os.path.split(__file__)[0])
2121
# add the stackless unittest dir to the package "test"
2222
test_path.insert(0, path)
2323

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
3041

3142
if __name__ == '__main__':
32-
main()
43+
main_in_temp_cwd()
3344
import gc
3445
gc.set_debug(gc.DEBUG_UNCOLLECTABLE)

0 commit comments

Comments
 (0)