-
-
Notifications
You must be signed in to change notification settings - Fork 18.2k
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
Correcting Warnings from IPython tab completion tests with async tests #29087
Conversation
@@ -5,13 +5,14 @@ | |||
|
|||
|
|||
class TestCategoricalWarnings: | |||
def test_tab_complete_warning(self, ip): | |||
@pytest.mark.asyncio |
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.
is asyncio a mark that pytest should always know about? it looks like the CI is failing because this mark isnt recognized. You may need to define it in conftest.py
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 didn't added the asyncio to the CI files yet, I was waiting for a Tom to explain to me. Once I add to the files, the CI will probably pass.
We need to add pytest-asyncio to the CI files in Though I wonder, for something this small, I wonder if it's possible to just write our own little helper to run the test? |
note averse to adding pytest-asyncio, and +1 rather than rolling our own here. |
So should I add to |
@gabriellm1 yea add it to the config files in the ci folder that currently have ipython. Will also want to add to |
I'm not sure what the best way to avoid the failure
I think that's from not having pytest-asyncio in that CI env. Ideally, we would work without that marker though, since this is an optional test dependency. |
Hm, I see. So what should be my next move from here? |
I'm not sure. I would see if there's a way to dynamically register pytest
markers in `pandas/conftest.py`. Something like
```python
try:
import pytest_asyncio
except ImportError:
asyncio = pytest.mark.skip(reason="pytest-asyncio not installed.")
# does that need to be registered with pytest somehow?
```
…On Tue, Oct 22, 2019 at 6:59 PM Gabriel Monteiro ***@***.***> wrote:
Hm, I see. So what should be my next move from here?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#29087?email_source=notifications&email_token=AAKAOIWBSEE2SXEC7INXJITQP6HWRA5CNFSM4JCNVCEKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEB7SWRI#issuecomment-545205061>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAKAOIUXSWNIQZENVACHLRLQP6HWRANCNFSM4JCNVCEA>
.
|
I really don't know where to go from here guys. Should I close it or wait for some help? |
@gabriellm1 - this is almost there steps to completion:
Which will automatically mark all coroutine test functions. (Think this might help some of the problems mentioned above)
|
I think the issue was with making pytest-asyncio optional. Will investigate
quick.
…On Sun, Nov 17, 2019 at 10:13 AM alimcmaster1 ***@***.***> wrote:
@gabriellm1 <https://github.com/gabriellm1> - I think this is almost
there steps to completion I think
1. Merge master - we have recently dropped python 3.5 support + builds
2. Instead of using @pytest.mark.asyncio
You can do:
# All test coroutines will be treated as marked.
pytestmark = pytest.mark.asyncio
Which will automatically mark all coroutine test functions.
(Think this might help some of the problems mentioned above)
1. Run isort that's causing the code checks CI to fail.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#29087?email_source=notifications&email_token=AAKAOISWKFQPVCOJL2IPVQLQUFUUDA5CNFSM4JCNVCEKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEEIPX7A#issuecomment-554761212>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAKAOIRUQ6D26UO6CWISYL3QUFUUDANCNFSM4JCNVCEA>
.
|
Well, it's not pretty but this does the trick import warnings
import pytest
ignore_coro_warnings = pytest.mark.filterwarnings("ignore::pytest.PytestUnhandledCoroutineWarning")
try:
import pytest_asyncio
with warnings.catch_warnings():
warnings.simplefilter("ignore")
async_mark = pytest.mark.asyncio
except ImportError:
async_mark = pytest.mark.skip(reason="Missing pytest-asyncio")
@async_mark
@ignore_coro_warnings
async def test_foo():
assert 0 Can you define those marks and apply them in every place that needs them? Then we don't need a hard test dependency on pytest-asyncio (which probably isn't worth it). |
@gabriellm1 can you address conflicts and incorporate feedback from @TomAugspurger ? |
@gabriellm1 is this still active? I can potentially take a look if you are no longer wanting to work on this. Thanks, Ali |
Closing as stale - reopened here #30689 |
black pandas
git diff upstream/master -u -- "*.py" | flake8 --diff
I tried to follow what Tom said in the issue but I don't really know how to integrate with CI. I was in doubt too with how to import pytest-asyncio as well. Maybe both questions are related.
If is possible for someone to explain, I will quickly make the necessary changes 😁