-
Notifications
You must be signed in to change notification settings - Fork 22
rework new process discovery #798
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
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
| pickle.dump((exitcode, tests, pytest_rootdir), f, protocol=pickle.HIGHEST_PROTOCOL) | ||
| try: | ||
| with Path(pickle_path).open("wb") as f: | ||
| pickle.dump((1, [], None), f, protocol=pickle.HIGHEST_PROTOCOL) |
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.
originally we're setting exitcode as -1 in the case of exception but here it's 1
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.
I guess it was not correct to have it as -1 in the first place according to the docs -> https://docs.pytest.org/en/stable/reference/exit-codes.html
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.
LGTM, a little bit skeptical about the validity of exit_code = getattr(session.config, "exitstatus", 0)
User description
previously, test results were written after pytest.main() completed, but pytest doesn't always exit with a success code even when collection is successful
this fixes test collection for https://github.com/temporalio/sdk-python
PR Type
Bug fix, Enhancement
Description
Write collection results during callback
Remove reliance on pytest exit code
Add safe file write via pathlib
Simplify pytest invocation arguments
Diagram Walkthrough
File Walkthrough
pytest_new_process_discovery.py
Persist collected tests during pytest hookcodeflash/discovery/pytest_new_process_discovery.py
pytest_collection_finishhook.Pathfor binary write and pickle highest protocol.exitcode; remove post-main write.