Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gwenaël Samain
cython
Commits
002b2148
Commit
002b2148
authored
Sep 02, 2012
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
minor cleanups in test runner, flush output regularly to avoid incomplete output on crashes
parent
1682b7c8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
8 deletions
+17
-8
runtests.py
runtests.py
+17
-8
No files found.
runtests.py
View file @
002b2148
...
...
@@ -750,14 +750,14 @@ class CythonRunTestCase(CythonCompileTestCase):
tests.run(result)
run_forked_test(result, run_test, self.shortDescription(), self.fork)
def run_forked_test(result, run_func, test_name, fork=True):
if not fork or sys.version_info[0] >= 3 or not hasattr(os, 'fork'):
run_func(result)
sys.stdout.flush()
sys.stderr.flush()
gc.collect()
return
module_name = test_name.split()[-1]
# fork to make sure we do not keep the tested module loaded
result_handle, result_file = tempfile.mkstemp()
os.close(result_handle)
...
...
@@ -770,6 +770,8 @@ def run_forked_test(result, run_func, test_name, fork=True):
try:
partial_result = PartialTestResult(result)
run_func(partial_result)
sys.stdout.flush()
sys.stderr.flush()
gc.collect()
except Exception:
if tests is None:
...
...
@@ -798,7 +800,7 @@ def run_forked_test(result, run_func, test_name, fork=True):
if result_code & 255:
raise Exception("
Tests
in
module
'%s'
were
unexpectedly
killed
by
signal
%
d
"%
(module_name, result_code & 255))
result_code
= result_code >>
8
result_code
>>=
8
if result_code in (0,1):
input = open(result_file, 'rb')
try:
...
...
@@ -947,15 +949,22 @@ class CythonPyregrTestCase(CythonRunTestCase):
def run_doctest(module, verbosity=None):
return self._run_doctest(result, module)
backup = (support.run_unittest, support.run_doctest)
support.run_unittest = run_unittest
support.run_doctest = run_doctest
try:
module = __import__(self.module)
if hasattr(module, 'test_main'):
module.test_main()
except (unittest.SkipTest, support.ResourceDenied):
result.addSkip(self, 'ok')
try:
sys.stdout.flush() # helps in case of crashes
module = __import__(self.module)
sys.stdout.flush() # helps in case of crashes
if hasattr(module, 'test_main'):
module.test_main()
sys.stdout.flush() # helps in case of crashes
except (unittest.SkipTest, support.ResourceDenied):
result.addSkip(self, 'ok')
finally:
support.run_unittest, support.run_doctest = backup
run_forked_test(result, run_test, self.shortDescription(), self.fork)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment