Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9803924

Browse files
committed
Fix #3314 assert mods.pop(0) fails
mods[0] does not contain the package name when installing via pip and running the multiprocess nose plugin. In the long term we should get rid of the namespace package
1 parent f7cf17f commit 9803924

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

lib/matplotlib/testing/decorators.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -328,8 +328,13 @@ def _image_directories(func):
328328
subdir = os.path.splitext(os.path.split(script_name)[1])[0]
329329
else:
330330
mods = module_name.split('.')
331-
mods.pop(0) # <- will be the name of the package being tested (in
332-
# most cases "matplotlib")
331+
if len(mods) >= 3:
332+
mods.pop(0)
333+
# mods[0] will be the name of the package being tested (in
334+
# most cases "matplotlib") However if this is a
335+
# namespace package pip installed and run via the nose
336+
# multiprocess plugin or as a specific test this may be
337+
# missing. See https://github.com/matplotlib/matplotlib/issues/3314
333338
assert mods.pop(0) == 'tests'
334339
subdir = os.path.join(*mods)
335340

0 commit comments

Comments
 (0)