for ext in self.extensions:
try:
self.build_extension(ext)
- except (CCompilerError, DistutilsError) as e:
+ except (CCompilerError, DistutilsError, CompileError) as e:
if not ext.optional:
raise
self.warn('building extension "%s" failed: %s' %
from distutils.tests.support import LoggingSilencer
from distutils.extension import Extension
from distutils.errors import UnknownFileError
+from distutils.errors import CompileError
import unittest
from test import support
dist = Distribution({'name': 'xx', 'ext_modules': modules})
cmd = build_ext(dist)
cmd.ensure_finalized()
- self.assertRaises(UnknownFileError, cmd.run) # should raise an error
+ self.assertRaises((UnknownFileError, CompileError),
+ cmd.run) # should raise an error
modules = [Extension('foo', ['xxx'], optional=True)]
dist = Distribution({'name': 'xx', 'ext_modules': modules})