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
Kirill Smelkov
cython
Commits
bde66547
Commit
bde66547
authored
May 01, 2014
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
capture C compiler output in test runner and discard it when expecting C compiler failures
parent
e1e15520
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
8 deletions
+26
-8
runtests.py
runtests.py
+26
-8
No files found.
runtests.py
View file @
bde66547
...
...
@@ -867,15 +867,33 @@ class CythonCompileTestCase(unittest.TestCase):
so_path = None
if not self.cython_only:
c_compiler_output = None
orig_stderr = os.dup(2) # remember original stderr
try:
with tempfile.TemporaryFile() as temp_stderr:
os.dup2(temp_stderr.fileno(), 2) # replace stderr by temp file
try:
try:
so_path = self.run_distutils(test_directory, module, workdir, incdir)
finally:
temp_stderr.seek(0)
c_compiler_output = temp_stderr.read().strip()
except Exception:
if expected_errors != '_FAIL_C_COMPILE':
if expected_errors == '_FAIL_C_COMPILE':
assert c_compiler_output
else:
raise
else:
if c_compiler_output:
print("
\
n
===
C
/
C
++
compiler
output
:
===
")
print(c_compiler_output)
if expected_errors == '_FAIL_C_COMPILE':
# must raise this outside the try block
raise RuntimeError('should have failed C compile')
finally:
os.dup2(orig_stderr, 2) # restore stderr
finally:
os.close(orig_stderr)
return so_path
class CythonRunTestCase(CythonCompileTestCase):
...
...
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