Skip to content

Add info to pytest.fail msg when image not found, to indicate baseline_dir where plugin was looking #76

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 24, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions pytest_mpl/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,9 +262,10 @@ def item_function_wrapper(*args, **kwargs):
baseline_image_ref = os.path.abspath(os.path.join(os.path.dirname(item.fspath.strpath), baseline_dir, filename))

if not os.path.exists(baseline_image_ref):
pytest.fail("Image file not found for comparison test. "
"(This is expected for new tests.)\nGenerated Image: "
"\n\t{test}".format(test=test_image), pytrace=False)
pytest.fail("Image file not found for comparison test in: "
"\n\t{baseline_dir}"
"\n(This is expected for new tests.)\nGenerated Image: "
"\n\t{test}".format(baseline_dir=baseline_dir, test=test_image), pytrace=False)

# distutils may put the baseline images in non-accessible places,
# copy to our tmpdir to be sure to keep them in case of failure
Expand Down