-
-
Notifications
You must be signed in to change notification settings - Fork 34
Fixing AsyncioCursor to not return a generator #93
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
Conversation
TypeEror 'async for' received an object from `__aiter__` that does not implement __anext__: generator
|
@MichalMazurek, thank you for your contributions! Could you please write some test for the change? (For example based on what you wrote in issue/10. We are trying to increase our coverage and make sure not to break anything in the future. It would be a huge help. |
|
Sure I will. |
|
Do you know a way to separate tests for 2.7 and 3.4? The legacies are complaining about |
|
@MichalMazurek Yes I know, you can use skipif (https://docs.pytest.org/en/latest/skipping.html#id1). The example there is especially for this situation. I would suggest not to allow failures on those python versions. |
|
@gabor-boros Oh I tried, and actually did it, but when pytest is importing them then it stops because of SyntaxError... It would have to be done on travis |
|
Hm, What you could do is to create a file where you put the async io related tests (ex: async def something():
passThen in the actual test @pytest.mark.asyncio
@pytest.mark.integration
@pytest.mark.skipif(sys.version_info < (3, 6), reason="requires python3.6 or higher")
def test_flow():
"""
Test the flow for 3.6 and up, async generators are
not supported in 3.5.
"""
from asyncio_tests import something
something()To be honest I never worked with async, but I think you can avoid the syntax error if you are import the async function only when the test will be not skipped. @grandquista, What do you think, how hacky is that? I know it is ugly but I can not think about a better solution right now. |
|
There should be a top level settings file that pytest has for limiting tests run. The coroutine decorator syntax should still be working in all versions, so that may be a better first pass. I’ll look up the pytest configuration Sent with GitHawk |
|
There should be a top level settings file that pytest has for limiting tests run. The coroutine decorator syntax should still be working in all versions, so that may be a better first pass. I’ll look up the pytest configuration https://docs.pytest.org/en/latest/pythonpath.html#test-modules-conftest-py-files-inside-packages Sent with GitHawk |
|
Maybe TRAVIS_PYTHON_VERSION could be used to check if python version is lower than 3.4 and then add |
|
@grandquista, @MichalMazurek what do you think about ‘pytest_ignore_collect’ hook? As I read this would be the cleanest solution |
|
pytest_collect_file seems to have cleaner documentation. There’s some weird language about first result early exits in the other. I’m also good with using the environment to set the command. It could be ignore by default and explicit extra includes so that running locally wouldn’t be surprising Sent with GitHawk |
|
Hi Guys, I will come back to you tomorrow with it, I had a busy day :) |
|
So this does the trick, @grandquista thanks for the tip! # conftest.py
import sys
collect_ignore = []
if sys.version_info < (3, 4):
collect_ignore += ["integration/test_asyncio.py", "integration/test_asyncio_coroutine.py"]
elif sys.version_info < (3, 6):
collect_ignore.append("integration/test_asyncio.py") |
TypeEror 'async for' received an object from
__aiter__that does not implement anext: generatorLink to the issue: #92