Closed maxzhenzhera closed 1 year ago
I did a few PRs and I don't know how to bump new versions concurrently
Again Error uploading to [https://codecov.io:](https://codecov.io/)
As in #103
Also, please, look at the tests/test_execute.py
, because I found here some strange things:
https://github.com/adriangb/di/blob/f8b0f4b38e6f43c4b5365bac1c663b64a60afefd/tests/test_execute.py#L121-L124
In many places anyio.Event.set()
is not await
ed:
This test:
https://github.com/adriangb/di/blob/f8b0f4b38e6f43c4b5365bac1c663b64a60afefd/tests/test_execute.py#L167-L206
Locally, I tried to fix question about await
ing asyncio.Event.set()
- but seems it does not help.
I haven't paid a lot of attention to how this works and how it should be - but I randomly changed sync1
and sync2
in multiple mark
places => and tests haven't failed.
Note: Maybe it is somehow related to a big copy-past that I deleted in PR (https://github.com/adriangb/di/pull/108/commits/62a3d8b60f3a5fcdc12313767dd201ea9cc58678)
Merging #108 (d4d09d6) into main (4d94386) will increase coverage by
0.40%
. The diff coverage is100.00%
.
:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.
@@ Coverage Diff @@
## main #108 +/- ##
==========================================
+ Coverage 96.57% 96.98% +0.40%
==========================================
Files 67 67
Lines 2280 2286 +6
Branches 331 333 +2
==========================================
+ Hits 2202 2217 +15
+ Misses 68 59 -9
Partials 10 10
Files Changed | Coverage Δ | |
---|---|---|
di/_utils/inspect.py | 100.00% <100.00%> (ø) |
|
tests/test_execute.py | 98.23% <100.00%> (+3.37%) |
:arrow_up: |
tests/test_task.py | 100.00% <100.00%> (ø) |
Found breaking commit: https://github.com/adriangb/di/commit/bf35a5acea3231d8278b4f4f3e97d2d44b50e1c5 (Removed handling of callable classes).
In many places anyio.Event.set() is not awaited:
I'm sorry for being wrong. Actually, my PyCharm highlighted it as await
able (but looking in the source I understood that it is deprecated).
I haven't paid a lot of attention to how this works and how it should be - but I randomly changed sync1 and sync2 in multiple mark places => and tests haven't failed.
As I found out - sync
params are just obsolete params: https://github.com/adriangb/di/commit/e43def722d1f3d6a5fce29ae5e367930c615288c
So, I fully removed these parameters from the test parametrize
.
Some additional notes about test_concurrency_async
:
with removing sync_to_thread
(https://github.com/adriangb/di/commit/f7051c1ca31f9f0fa2653ae05ff6b56b3160fada, https://github.com/adriangb/di/commit/e43def722d1f3d6a5fce29ae5e367930c615288c) you added as_async
wrapper (https://github.com/adriangb/di/commit/f7051c1ca31f9f0fa2653ae05ff6b56b3160fada#diff-a1a77ec455d6596eaee848c37661eed959a83b787427364bc494ae32147ea24b)
It is used only in tests/
(test_execute.py
, test_concurrency.py
) to wrap sync callables.
wrap sync callables - this is another point
As I understand, this test serves as verification that concurrent async execution just works.
And as_async
wrapping proves that concurrent async execution works with sync callables running in anyio
threadpool (it is actually what as_async
does) - and my question is there any reason to do this?
Because for me reading this code introduces some ambiguity and misunderstanding.
So, I propose (idea for another PR):
as_async
(https://github.com/adriangb/di/blob/main/di/_utils/concurrency.py) to tests/
test_concurrency_async
to explain the role of this case
(possibly with removing as_async
wrappings if not reason for it)Finally, test_concurrency.py
(https://github.com/adriangb/di/blob/main/tests/test_concurrency.py)
Since as_async
is used only in tests - test_concurrency.py
looks like testing test code.
Sounds kind of strange.
@adriangb, please review
Closes #106