-
Notifications
You must be signed in to change notification settings - Fork 18
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
Workaround lru_cache decorator on method garbage collection problem #344
Conversation
lru_cache, if used on a method, retains the class instance beyond the point it would normally be garbage collected
Codecov Report
@@ Coverage Diff @@
## master #344 +/- ##
==========================================
+ Coverage 77.76% 78.05% +0.28%
==========================================
Files 10 10
Lines 1048 1048
Branches 202 202
==========================================
+ Hits 815 818 +3
+ Misses 196 194 -2
+ Partials 37 36 -1
Continue to review full report at Codecov.
|
MacOS test failure is pretty strange, doesn't seem related to this change, but doesn't fail on master though |
Well I don't know why it's resolved itself. Possibly needed However, still getting these printed out after the end of the pytest output
|
I have raised this with @oliver-sanders before, from memory, it only occurs when the python version is >=3.9. See conversation after #324 (review) |
It's happening for Python 3.7 on this branch and master: https://github.com/cylc/cylc-uiserver/runs/6160205704?check_suite_focus=true#step:7:80 I saw this comment on #324:
Is it worth raising an issue there? |
Looks like they are aware: jupyter-server/jupyter_server#672 (comment) |
pyproject.toml
Outdated
@@ -22,3 +22,4 @@ testpaths = [ | |||
markers = [ | |||
'integration: tests which run servers and try to connect to them' | |||
] | |||
asyncio_mode = 'strict' # 'auto' seems to conflict with pytest-tornasync |
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.
Makes sense, this async means tests need an explicit pytest.mark.asyncio
? Need to check that relevant tests are decorated correctly otherwise they will be skipped from here on.
Hmm, adding
Seems to be only the tests that use the |
Seems to conflict with pytest-tornasync. And pytest-tornasync should be capable of running the async tests itself anyway
|
Makes sense, thanks for investigating this. |
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 have manually tested this, working well. This was the initial implementation, @oliver-sanders just checking there is not a reason for the requested change, I am struggling to remember... be7d04d#r728858282
#204 (comment) - that was before we realised about the problem of using |
Yes, I understand why it is being changed now, I am wondering if there was a specific reason why it was requested to be changed before. As in, was there a problem with that implementation that I can not think of now? |
It's a little yukky compared to the cleanliness of simply decorating the method |
This branch has conflicts now. If you want to get this rebased I can give it a final check before it goes in @MetRonnie? |
Will merge master into this branch rather than rebase - makes the conflict resolution diff easy to see |
These changes close #330
@lru_cache
, if used on a method, retains the class instance beyond the point it would normally be garbage collected. This workaround is from https://stackoverflow.com/a/68550238/3217306This PR also includes some minor GH Actions test workflow updates and removes pytest-asyncio (see pytest-dev/pytest-asyncio#257 (comment))
Requirements check-list
CONTRIBUTING.md
and added my name as a Code Contributor.