add support for "async with cursor_context()"
resolves https://github.com/aio-libs/aiopg/issues/264
Codecov Report
Merging #265 into master will increase coverage by
0.28%. The diff coverage is100%.
@@ Coverage Diff @@
## master #265 +/- ##
==========================================
+ Coverage 93.66% 93.95% +0.28%
==========================================
Files 25 25
Lines 3744 3787 +43
Branches 199 202 +3
==========================================
+ Hits 3507 3558 +51
+ Misses 199 191 -8
Partials 38 38
| Impacted Files | Coverage Δ | |
|---|---|---|
| aiopg/utils.py | 90.05% <100%> (+6.61%) |
:arrow_up: |
| aiopg/pool.py | 98.91% <100%> (-0.02%) |
:arrow_down: |
| tests/test_connection.py | 98.23% <100%> (ø) |
:arrow_up: |
| aiopg/cursor.py | 98.82% <100%> (+0.03%) |
:arrow_up: |
| tests/pep492/test_async_await.py | 100% <100%> (ø) |
:arrow_up: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing dataPowered by Codecov. Last update 8cea23e...1133c6a. Read the comment docs.
Good point, is it possible to hack something so we can support both: async with (await pool.cursor()) and async with pool.cursor() and then deprecate first example in next release?
ya I'll work something up in the next few days
@jettify ok, I think I've done it to have the current method backwards and forwards compatible. Getting it to work was tricky. Just tweaking the unittests now for code coverage. Let me know what you think.
@jettify ping :)
I'm using this branch in development and it works very well 👍 .
@jettify I removed the deprecation warning per @asvetlov since it does technically work, we can deprecate it later I suppose.
ugh, unfortunately don't have enough time to figure out why this fails in travis, gonna revert the docker client upgrade changes :(
hmm, @asvetlov let me know what you think of this error: https://travis-ci.org/aio-libs/aiopg/jobs/250130251#L1360
hmm, this was supposed to have been fixed by https://github.com/aio-libs/aiopg/commit/8ca948ec8e8813065483f799187cfc80f04e268d
ok, looks like you later refactored it in https://github.com/aio-libs/aiopg/commit/2a72b6097e9d0a4c23318b03e57e10767acbbdd4#diff-3416729d6745fac0ca3dd44b22a69068 however it looks like it doesn't work with the latest psycopg2, so I'll let you decide how you want to fix it
@asvetlov ok everything is now passing, let me know if you'd like any other changes
@asvetlov anything left? let's get this merged :)
(after I fix this having broken after merging from master)
@vir-mir @asvetlov can we get this merged?
I can take a look in a few days
FYI failures not my fault
@asvetlov @vir-mir ? :)
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.