test: make GC check resilient to broken weakrefs#1099
test: make GC check resilient to broken weakrefs#1099tswast merged 4 commits intogoogleapis:mainfrom
Conversation
In some python deployments (I believe macOS is one), weakref objects aren't guaranteed to exist across gc collections. The proposed check pattern is also used in tensorflow [0] which ran into similar issues a few years ago. [0]: https://github.com/tensorflow/tensorflow/blob/master/tensorflow/python/framework/errors_test.py#L33
tswast
left a comment
There was a problem hiding this comment.
Thanks for the contribution! I hadn't noticed any flakes when running the test suite locally on my Mac, but could just be a rare thing.
|
Any idea what the conventional commit error is? |
This is the output, accessible by clicking the "Details" link next to the failed check (is it displayed for you?): BTW, I changed the title of the PR to fix that (as an alternative to amending the commit message itself), added the most sensible prefix ( |
There was a problem hiding this comment.
LGTM, just have a clarification question, thanks!
Edit: Please just fix the indentation (4 spaces should be used) to conform to this project's style guide, which is why one of the checks failed:
nox > flake8 tests
tests/unit/test_dbapi_connection.py:224:11: E111 indentation is not a multiple of 4
tests/unit/test_dbapi_connection.py:226:15: E111 indentation is not a multiple of 4
tests/unit/test_dbapi_connection.py:227:11: E111 indentation is not a multiple of 4
nox > Command flake8 tests failed with exit code 1
nox > Session lint failed.
|
@tswast I don't have write access anymore, please re-run the tests and merge the fix, thanks! |
* fix: Make gc check resilient to broken weakrefs In some python deployments (I believe macOS is one), weakref objects aren't guaranteed to exist across gc collections. The proposed check pattern is also used in tensorflow [0] which ran into similar issues a few years ago. [0]: https://github.com/tensorflow/tensorflow/blob/master/tensorflow/python/framework/errors_test.py#L33 * fix: add pragma for coverage * Fix whitespace
In some python deployments (I believe macOS is one), weakref objects aren't guaranteed to exist across gc collections. The proposed check pattern is also used in tensorflow (link) which ran into similar issues a few years ago.