Commit c646da0b authored by Robert Bradshaw's avatar Robert Bradshaw

Use try-else for filed C compile.

parent 5e0facb6
...@@ -869,14 +869,13 @@ class CythonCompileTestCase(unittest.TestCase): ...@@ -869,14 +869,13 @@ class CythonCompileTestCase(unittest.TestCase):
if not self.cython_only: if not self.cython_only:
try: try:
so_path = self.run_distutils(test_directory, module, workdir, incdir) so_path = self.run_distutils(test_directory, module, workdir, incdir)
compiled = True
except Exception: except Exception:
compiled = False
if expected_errors != '_FAIL_C_COMPILE': if expected_errors != '_FAIL_C_COMPILE':
raise raise
if compiled and expected_errors == '_FAIL_C_COMPILE': else:
# must raise this outside the try block if expected_errors == '_FAIL_C_COMPILE':
raise RuntimeError('should have failed C compile') # must raise this outside the try block
raise RuntimeError('should have failed C compile')
return so_path return so_path
class CythonRunTestCase(CythonCompileTestCase): class CythonRunTestCase(CythonCompileTestCase):
......
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