Skip to content
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

Closed
wants to merge 9 commits into from
Closed

Correcting Warnings from IPython tab completion tests with async tests #29087

wants to merge 9 commits into from

Conversation

gabriellm1
Copy link
Contributor

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 😁

@@ -5,13 +5,14 @@


class TestCategoricalWarnings:
def test_tab_complete_warning(self, ip):
@pytest.mark.asyncio
Copy link
Member

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

Copy link
Contributor Author

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.

@TomAugspurger
Copy link
Contributor

We need to add pytest-asyncio to the CI files in ci/deps/. Anywhere you see IPython.

Though I wonder, for something this small, I wonder if it's possible to just write our own little helper to run the test?

@jreback
Copy link
Contributor

jreback commented Oct 19, 2019

note averse to adding pytest-asyncio, and +1 rather than rolling our own here.

@jreback jreback added Output-Formatting __repr__ of pandas objects, to_string Testing pandas testing functions or related to the test suite labels Oct 19, 2019
@gabriellm1
Copy link
Contributor Author

So should I add to ci/deps/ ? If not could you explain a little more about this little helper you suggested that we write?

@WillAyd
Copy link
Member

WillAyd commented Oct 22, 2019

@gabriellm1 yea add it to the config files in the ci folder that currently have ipython. Will also want to add to environment.yaml and then run scripts/generate_pip_deps_from_conda.py before commit

@TomAugspurger
Copy link
Contributor

TomAugspurger commented Oct 22, 2019

I'm not sure what the best way to avoid the failure

==================================== ERRORS ====================================
______ ERROR collecting pandas/tests/arrays/categorical/test_warnings.py _______
'asyncio' not found in `markers` configuration option
--------- generated xml file: /home/vsts/work/1/s/test-data-single.xml ---------
========================== slowest 10 test durations ===========================

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.

@gabriellm1
Copy link
Contributor Author

Hm, I see. So what should be my next move from here?

@TomAugspurger
Copy link
Contributor

TomAugspurger commented Oct 23, 2019 via email

@gabriellm1
Copy link
Contributor Author

I really don't know where to go from here guys. Should I close it or wait for some help?

@alimcmaster1
Copy link
Member

alimcmaster1 commented Nov 17, 2019

@gabriellm1 - this is almost there steps to completion:

  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.

@TomAugspurger
Copy link
Contributor

TomAugspurger commented Nov 17, 2019 via email

@TomAugspurger
Copy link
Contributor

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).

@WillAyd
Copy link
Member

WillAyd commented Dec 17, 2019

@gabriellm1 can you address conflicts and incorporate feedback from @TomAugspurger ?

@alimcmaster1
Copy link
Member

@gabriellm1 is this still active? I can potentially take a look if you are no longer wanting to work on this.

Thanks,

Ali

@alimcmaster1
Copy link
Member

Closing as stale - reopened here #30689

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Output-Formatting __repr__ of pandas objects, to_string Testing pandas testing functions or related to the test suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Warnings from IPython tab completion tests
6 participants