-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
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
Conversation
- 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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
assert_equal = TestCase().assertEqual | ||
assert_raises = TestCase().assertRaises |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optional: Switch to pytest?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
Move the long test-scripts to separate functions and extract their
source using
inspect.getsource
to pass that to the subprocess; thisavoids 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
pytest
passes).flake8
on changed files to check).flake8-docstrings
and runflake8 --docstring-convention=all
).doc/users/next_whats_new/
(follow instructions in README.rst there).doc/api/next_api_changes/
(follow instructions in README.rst there).