Skip to content

Commit

Permalink
Issue python#133: Fix the Stackless test suite
Browse files Browse the repository at this point in the history
Adapt Stackless/unittests/runAll.py to issue python#25220.
  • Loading branch information
Anselm Kruis committed Oct 6, 2017
1 parent 1dd094a commit d70d671
Showing 1 changed file with 20 additions and 9 deletions.
29 changes: 20 additions & 9 deletions Stackless/unittests/runAll.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,33 @@
# just to make sure, it can be imported
import support # @UnusedImport

from test import regrtest
from test import libregrtest
from test import __path__ as test_path

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

# monkey patch: remove all standard tests
del regrtest.STDTESTS[:]


def main():
return regrtest.main(testdir=path)
def main(tests=None, **kwargs):
kwargs.setdefault("testdir", path)
return libregrtest.main(tests=tests, **kwargs)

def main_in_temp_cwd(tests=None, **kwargs):
kwargs.setdefault("testdir", path)
# unfortunately, libregrtest.main_in_temp_cwd() does not support
# **kwargs. Monkey patch it
mglobals = libregrtest.main_in_temp_cwd.__globals__
real_main = mglobals["main"]
def main():
return real_main(tests, **kwargs)
mglobals["main"] = main
try:
libregrtest.main_in_temp_cwd()
finally:
mglobals["main"] = real_main

if __name__ == '__main__':
main()
main_in_temp_cwd()
import gc
gc.set_debug(gc.DEBUG_UNCOLLECTABLE)

0 comments on commit d70d671

Please sign in to comment.