8000 Setup.py dont catch import error · matplotlib/matplotlib@8c30aa3 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8c30aa3

Browse files
committed
Setup.py dont catch import error
It is more informative to raise the error here
1 parent ff34bb9 commit 8c30aa3

File tree

1 file changed

+30
-33
lines changed

1 file changed

+30
-33
lines changed

setup.py

Lines changed: 30 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ def finalize_options(self):
163163
from distutils.errors import DistutilsOptionError
164164
raise DistutilsOptionError(
165165
"You are using several options for the test command in an "
166-
"incompatible manner. Please use either one of --pep8-only,"
166+
"incompatible manner. Please use either --pep8-only or "
167167
"--omit-pep8"
168168
)
169169

@@ -203,38 +203,35 @@ def run(self):
203203

204204

205205
def run_tests(self):
206-
try:
207-
import matplotlib
208-
matplotlib.use('agg')
209-
import nose
210-
from matplotlib.testing.noseclasses import KnownFailure
211-
from matplotlib import default_test_modules as testmodules
212-
from matplotlib import font_manager
213-
import time
214-
# Make sure the font caches are created before starting any possibly
215-
# parallel tests
216-
if font_manager._fmcache is not None:
217-
while not os.path.exists(font_manager._fmcache):
218-
time.sleep(0.5)
219-
plugins = [KnownFailure]
220-
221-
# Nose doesn't automatically instantiate all of the plugins in the
222-
# child processes, so we have to provide the multiprocess plugin
223-
# with a list.
224-
from nose.plugins import multiprocess
225-
multiprocess._instantiate_plugins = plugins
226-
227-
if self.omit_pep8:
228-
testmodules.remove('matplotlib.tests.test_coding_standards')
229-
elif self.pep8_only:
230-
testmodules = ['matplotlib.tests.test_coding_standards']
231-
232-
nose.main(addplugins=[x() for x in plugins],
233-
defaultTest=testmodules,
234-
argv=['nosetests'] + self.test_args,
235-
exit=False)
236-
except ImportError:
237-
sys.exit(-1)
206+
import matplotlib
207+
matplotlib.use('agg')
208+
import nose
209+
from matplotlib.testing.noseclasses import KnownFailure
210+
from matplotlib import default_test_modules as testmodules
211+
from matplotlib import font_manager
212+
import time
213+
# Make sure the font caches are created before starting any possibly
214+
# parallel tests
215+
if font_manager._fmcache is not None:
216+
while not os.path.exists(font_manager._fmcache):
217+
time.sleep(0.5)
218+
plugins = [KnownFailure]
219+
220+
# Nose doesn't automatically instantiate all of the plugins in the
221+
# child processes, so we have to provide the multiprocess plugin
222+
# with a list.
223+
from nose.plugins import multiprocess
224+
multiprocess._instantiate_plugins = plugins
225+
226+
if self.omit_pep8:
227+
testmodules.remove('matplotlib.tests.test_coding_standards')
228+
elif self.pep8_only:
229+
testmodules = ['matplotlib.tests.test_coding_standards']
230+
231+
nose.main(addplugins=[x() for x in plugins],
232+
defaultTest=testmodules,
233+
argv=['nosetests'] + self.test_args,
234+
exit=False)
238235

239236

240237
# One doesn't normally see `if __name__ == '__main__'` blocks in a setup.py,

0 commit comments

Comments
 (0)
0