Skip to content

Commit 5240759

Browse files
committed
Merge pull request #5842 from maxalbert/allow_image_comparison_outside_tests_module
Allow image comparison outside tests module
1 parent 501888a commit 5240759

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

lib/matplotlib/testing/decorators.py

+10-2
Original file line numberDiff line numberDiff line change
@@ -335,12 +335,20 @@ def _image_directories(func):
335335
# namespace package pip installed and run via the nose
336336
# multiprocess plugin or as a specific test this may be
337337
# missing. See https://github.com/matplotlib/matplotlib/issues/3314
338-
assert mods.pop(0) == 'tests'
338+
if mods.pop(0) != 'tests':
339+
warnings.warn(("Module '%s' does not live in a parent module "
340+
"named 'tests'. This is probably ok, but we may not be able "
341+
"to guess the correct subdirectory containing the baseline "
342+
"images. If things go wrong please make sure that there is "
343+
"a parent directory named 'tests' and that it contains a "
344+
"__init__.py file (can be empty).") % module_name)
339345
subdir = os.path.join(*mods)
340346

341347
import imp
342348
def find_dotted_module(module_name, path=None):
343-
"""A version of imp which can handle dots in the module name"""
349+
"""A version of imp which can handle dots in the module name.
350+
As for imp.find_module(), the return value is a 3-element
351+
tuple (file, pathname, description)."""
344352
res = None
345353
for sub_mod in module_name.split('.'):
346354
try:

0 commit comments

Comments
 (0)