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

Skip to content

BF: ensure exception caught if no kpeswitch #18475

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 14, 2020

Conversation

brunobeltran
Copy link
Contributor

@brunobeltran brunobeltran commented Sep 14, 2020

PR Summary

Currently, if there is no LaTeX install on a system, we document that we return the empty string for any LaTeX strings (see e.g. dviread.find_tex_file).

However, on my system, I instead get the cryptic (from an end-user's perspective) FileNotFoundError for kpeswitch.

Easy enough to fix by just catching this error, we're already catching RuntimeError.

PR Checklist

  • Has pytest style unit tests (and pytest passes).
  • Is Flake 8 compliant (run flake8 on changed files to check).
  • [N/A] New features are documented, with examples if plot related.
  • [N/A] Documentation is sphinx and numpydoc compliant (the docs should build without error).
  • [N/A] Conforms to Matplotlib style conventions (install flake8-docstrings and pydocstyle<4 and run flake8 --docstring-convention=all).
  • [N/A] New features have an entry in doc/users/next_whats_new/ (follow instructions in README.rst there).
  • [N/A] API changes documented in doc/api/next_api_changes/ (follow instructions in README.rst there).

@brunobeltran
Copy link
Contributor Author

P.S. Not sure how to test this, since it requires no LaTeX be installed, and our tests require LaTeX be installed. I could shim _check_and_log_subprocess to attempt to execute a nonsense command like kpsewhichdoesnotexist....I'll do it if it's requested.

Alternatively, we currently skip our test of dviread in the case when no kpsewhich is installed. Should we just have a separate test that only runs when it's not installed and checks that it returns an empty string?

Copy link
Member

@tacaswell tacaswell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the other places where we use this we have already checked that the expected executable exists.

Is worth adding a note to the docstring of _check_and_log_subprocess that you are still responsible for the file not existing?

I would not worry about adding a test for this, the trade off of effort required to make it work vs the scale of the bug it is protecting us from coming back is not in it's favor.

@tacaswell
Copy link
Member

the OSX failure is pip not seeing pyqt5 or new versions of pyside2 to install, it is not worth holding this PR over it.

@tacaswell tacaswell added this to the v3.3.2 milestone Sep 14, 2020
@QuLogic QuLogic merged commit 6a75087 into matplotlib:master Sep 14, 2020
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Sep 14, 2020
dopplershift added a commit that referenced this pull request Sep 15, 2020
…475-on-v3.3.x

Backport PR #18475 on branch v3.3.x (BF: ensure exception caught if no kpeswitch)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants