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
Show 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):
...
@@ -750,14 +750,14 @@ class CythonRunTestCase(CythonCompileTestCase):
tests.run(result)
tests.run(result)
run_forked_test(result, run_test, self.shortDescription(), self.fork)
run_forked_test(result, run_test, self.shortDescription(), self.fork)
def run_forked_test(result, run_func, test_name, fork=True):
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'):
if not fork or sys.version_info[0] >= 3 or not hasattr(os, 'fork'):
run_func(result)
run_func(result)
sys.stdout.flush()
sys.stderr.flush()
gc.collect()
gc.collect()
return
return
module_name = test_name.split()[-1]
# 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)
os.close(result_handle)
...
@@ -770,6 +770,8 @@ def run_forked_test(result, run_func, test_name, fork=True):
...
@@ -770,6 +770,8 @@ def run_forked_test(result, run_func, test_name, fork=True):
try:
try:
partial_result = PartialTestResult(result)
partial_result = PartialTestResult(result)
run_func(partial_result)
run_func(partial_result)
sys.stdout.flush()
sys.stderr.flush()
gc.collect()
gc.collect()
except Exception:
except Exception:
if tests is None:
if tests is None:
...
@@ -798,7 +800,7 @@ def run_forked_test(result, run_func, test_name, fork=True):
...
@@ -798,7 +800,7 @@ def run_forked_test(result, run_func, test_name, fork=True):
if result_code & 255:
if result_code & 255:
raise Exception("
Tests
in
module
'%s'
were
unexpectedly
killed
by
signal
%
d
"%
raise Exception("
Tests
in
module
'%s'
were
unexpectedly
killed
by
signal
%
d
"%
(module_name, result_code & 255))
(module_name, result_code & 255))
result_code
= result_code >>
8
result_code
>>=
8
if result_code in (0,1):
if result_code in (0,1):
input = open(result_file, 'rb')
input = open(result_file, 'rb')
try:
try:
...
@@ -947,15 +949,22 @@ class CythonPyregrTestCase(CythonRunTestCase):
...
@@ -947,15 +949,22 @@ class CythonPyregrTestCase(CythonRunTestCase):
def run_doctest(module, verbosity=None):
def run_doctest(module, verbosity=None):
return self._run_doctest(result, module)
return self._run_doctest(result, module)
backup = (support.run_unittest, support.run_doctest)
support.run_unittest = run_unittest
support.run_unittest = run_unittest
support.run_doctest = run_doctest
support.run_doctest = run_doctest
try:
try:
try:
sys.stdout.flush() # helps in case of crashes
module = __import__(self.module)
module = __import__(self.module)
sys.stdout.flush() # helps in case of crashes
if hasattr(module, 'test_main'):
if hasattr(module, 'test_main'):
module.test_main()
module.test_main()
sys.stdout.flush() # helps in case of crashes
except (unittest.SkipTest, support.ResourceDenied):
except (unittest.SkipTest, support.ResourceDenied):
result.addSkip(self, 'ok')
result.addSkip(self, 'ok')
finally:
support.run_unittest, support.run_doctest = backup
run_forked_test(result, run_test, self.shortDescription(), self.fork)
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