Repository navigation
Add atomic coverage tests for cloudpickle_fast and is_tornado_coroutine - #625
Open
zheng-guannan577 wants to merge 2 commits into
Open
zheng-guannan577 wants to merge 2 commits into
zheng-guannan577 wants to merge 2 commits into
Conversation
Add tests for is_tornado_coroutine with and without tornado.gen
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #346 (in part — this PR covers two small, self-contained spots; more atomic PRs can follow for the remaining uncovered sections).
What this PR adds
Measured with a fresh local coverage run (Python 3.12,
pytest tests/cloudpickle_test.py tests/cloudpickle_file_test.py tests/test_backward_compat.py), total coverage goes from 88% to 89%. Two uncovered spots, each with its own topical tests:cloudpickle/cloudpickle_fast.py— 0% → 100% (tests/test_backward_compat.py)test_cloudpickle_fast_forwards_public_names:CloudPickler,Pickler,dumpsandloadsaccessed throughcloudpickle_fastare the very same objects as oncloudpickle(PEP 562__getattr__forwarding for pickles generated by previous cloudpickle versions).test_cloudpickle_fast_unknown_attribute_raises_attribute_error: accessing an unknown attribute still raisesAttributeError.tests/test_backward_compat.py, but no test had ever exercised it.is_tornado_coroutineFalse branches (cloudpickle/cloudpickle.py:463, 467,tests/cloudpickle_test.py)test_is_tornado_coroutine_without_tornado_gen: returnsFalsewhentornado.genwas never imported (monkeypatch.delitem(sys.modules, "tornado.gen")).test_is_tornado_coroutine_with_old_tornado: returnsFalsewhentornado.genexists but has nois_coroutine_function(stub module simulating an old Tornado).DeprecationWarning. The existingtest_tornado_coroutineonly covers theTruepath.What this PR does not do
co_nmetabranches, which cannot be exercised on CPython 3.12 — left for follow-up atomic PRs if desired).Verification
git diff --checkclean; no new ruff findings on the touched files (repo baseline has pre-existing findings, unchanged by this PR).Disclosure
This PR was drafted with AI assistance and verified locally by running the test suite and coverage as described above. No maintainer endorsement is claimed or implied.