Add context support to progress TaskID objects #3805
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Type of changes
Checklist
Description
Changed progress TaskID from a simple newtype to it's own class that expects a self instance of Progress to be passed into it's constructor to allow for support of context management that automatically removes the associated task upon context exit.
This is my first time ever making a PR and contributing to a public project before, so bear with me please.
I tried my best to follow the instructions and guidelines in the Rich contribution guide.
Tests
Almost all the tests passed except 4 which I'm not sure how to fix since I'm not experienced enough with python tests.
The tests for Tasks fail to account for the fact that TaskID now expects an instance of Progress to be passed in as a parameter, and I'm not sure how to get an instance of one within the context of each test.
test_log fails for some reason even though I never touched any code outside of progress.py. I can only assume it is something wrong with my own testing environment.
If anyone can give me advice on the best way to modify the Task tests such that they pass, it would be much appreciated.