Commit b5bcc8c4 authored by Robert Bradshaw's avatar Robert Bradshaw

Fix too many open files bug in testrunner.

It seems that temp file handles don't work well with fork.
parent 75ab0c6e
...@@ -404,12 +404,12 @@ class CythonRunTestCase(CythonCompileTestCase): ...@@ -404,12 +404,12 @@ class CythonRunTestCase(CythonCompileTestCase):
# fork to make sure we do not keep the tested module loaded # fork to make sure we do not keep the tested module loaded
result_handle, result_file = tempfile.mkstemp() result_handle, result_file = tempfile.mkstemp()
os.close(result_handle)
child_id = os.fork() child_id = os.fork()
if not child_id: if not child_id:
result_code = 0 result_code = 0
try: try:
try: try:
output = os.fdopen(result_handle, 'wb')
tests = None tests = None
try: try:
partial_result = PartialTestResult(result) partial_result = PartialTestResult(result)
...@@ -425,6 +425,7 @@ class CythonRunTestCase(CythonCompileTestCase): ...@@ -425,6 +425,7 @@ class CythonRunTestCase(CythonCompileTestCase):
**{module_name: None}) **{module_name: None})
partial_result.addError(tests, sys.exc_info()) partial_result.addError(tests, sys.exc_info())
result_code = 1 result_code = 1
output = open(result_file, 'wb')
pickle.dump(partial_result.data(), output) pickle.dump(partial_result.data(), output)
except: except:
import traceback import traceback
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment