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

Skip to content

Rework interactive backends tests. #18908

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
Nov 7, 2020
Merged

Rework interactive backends tests. #18908

merged 1 commit into from
Nov 7, 2020

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented Nov 6, 2020

  • Move the long test-scripts to separate functions and extract their
    source using inspect.getsource to pass that to the subprocess; this
    avoids having really long source snippets in strings and lets us have
    e.g. syntax highlighting on them.

  • Use ThreadPoolExecutor in test_interactive_thread_safety /
    _test_thread_impl which provides a much simpler (basically automatic)
    API to rethrow exceptions from within the thread.

PR Summary

PR Checklist

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

- Move the long test-scripts to separate functions and extract their
  source using `inspect.getsource` to pass that to the subprocess; this
  avoids having really long source snippets in strings and lets us have
  e.g. syntax highlighting on them.

- Use ThreadPoolExecutor in test_interactive_thread_safety /
  _test_thread_impl which provides a much simpler (basically automatic)
  API to rethrow exceptions from within the thread.
_test_timeout = 10 # Empirically, 1s is not enough on Travis.


# The source of this function gets extracted and run in another process, so it
Copy link
Member

Choose a reason for hiding this comment

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

Can this become a docstring?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's not really a doc about the function but rather a comment about how it needs to be implemented?

Copy link
Member

Choose a reason for hiding this comment

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

IMHO that's splitting hairs. But no strong opinion either way.

Comment on lines +93 to +94
assert_equal = TestCase().assertEqual
assert_raises = TestCase().assertRaises
Copy link
Member

Choose a reason for hiding this comment

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

Optional: Switch to pytest?

Copy link
Contributor Author

@anntzer anntzer Nov 6, 2020

Choose a reason for hiding this comment

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

You can't, because this is run in another (non-pytest) subprocess so pytest magic-subsitution doesn't happen here.

Copy link
Member

@timhoffm timhoffm Nov 7, 2020

Choose a reason for hiding this comment

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

Fair point. We might want to put a comment on this.

@QuLogic QuLogic merged commit 39125d6 into matplotlib:master Nov 7, 2020
@QuLogic QuLogic added this to the v3.4.0 milestone Nov 7, 2020
@anntzer anntzer deleted the tbi branch November 7, 2020 11:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants