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

pytest-asyncio 0.23.2 will cause pytest INTERNALERROR when encounter module level unittest.SkipTest #711

Closed
hoxbro opened this issue Dec 6, 2023 · 5 comments · Fixed by #715
Labels
Milestone

Comments

@hoxbro
Copy link

hoxbro commented Dec 6, 2023

Mostly identical to #655, just with unittest.SkipTest, worked in version 0.21.

from unittest import SkipTest

try:
    import cudf
except ImportError:
    raise SkipTest("Could not import cuDF, skipping cuDFInterface tests.")
❯ pytest .           
============================= test session starts ==============================
platform linux -- Python 3.11.6, pytest-7.4.3, pluggy-1.3.0
rootdir: /home/shh/Downloads/tmp
plugins: asyncio-0.23.2
asyncio: mode=Mode.STRICT
collected 0 items                                                              
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/home/shh/Downloads/tmp/test_example.py", line 4, in <module>
INTERNALERROR>     import cudf
INTERNALERROR> ModuleNotFoundError: No module named 'cudf'
INTERNALERROR> 
INTERNALERROR> During handling of the above exception, another exception occurred:
INTERNALERROR> 
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/home/shh/miniconda3/envs/tmp_asyncio/lib/python3.11/site-packages/_pytest/main.py", line 271, in wrap_session
INTERNALERROR>     session.exitstatus = doit(config, session) or 0
INTERNALERROR>                          ^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/home/shh/miniconda3/envs/tmp_asyncio/lib/python3.11/site-packages/_pytest/main.py", line 324, in _main
INTERNALERROR>     config.hook.pytest_collection(session=session)
INTERNALERROR>   File "/home/shh/miniconda3/envs/tmp_asyncio/lib/python3.11/site-packages/pluggy/_hooks.py", line 493, in __call__
INTERNALERROR>     return self._hookexec(self.name, self._hookimpls, kwargs, firstresult)
INTERNALERROR>            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/home/shh/miniconda3/envs/tmp_asyncio/lib/python3.11/site-packages/pluggy/_manager.py", line 115, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR>            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/home/shh/miniconda3/envs/tmp_asyncio/lib/python3.11/site-packages/pluggy/_callers.py", line 152, in _multicall
INTERNALERROR>     return outcome.get_result()
INTERNALERROR>            ^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/home/shh/miniconda3/envs/tmp_asyncio/lib/python3.11/site-packages/pluggy/_result.py", line 114, in get_result
INTERNALERROR>     raise exc.with_traceback(exc.__traceback__)
INTERNALERROR>   File "/home/shh/miniconda3/envs/tmp_asyncio/lib/python3.11/site-packages/pluggy/_callers.py", line 77, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>           ^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/home/shh/miniconda3/envs/tmp_asyncio/lib/python3.11/site-packages/_pytest/main.py", line 335, in pytest_collection
INTERNALERROR>     session.perform_collect()
INTERNALERROR>   File "/home/shh/miniconda3/envs/tmp_asyncio/lib/python3.11/site-packages/_pytest/main.py", line 675, in perform_collect
INTERNALERROR>     self.items.extend(self.genitems(node))
INTERNALERROR>   File "/home/shh/miniconda3/envs/tmp_asyncio/lib/python3.11/site-packages/_pytest/main.py", line 842, in genitems
INTERNALERROR>     rep = collect_one_node(node)
INTERNALERROR>           ^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/home/shh/miniconda3/envs/tmp_asyncio/lib/python3.11/site-packages/_pytest/runner.py", line 546, in collect_one_node
INTERNALERROR>     ihook.pytest_collectstart(collector=collector)
INTERNALERROR>   File "/home/shh/miniconda3/envs/tmp_asyncio/lib/python3.11/site-packages/pluggy/_hooks.py", line 493, in __call__
INTERNALERROR>     return self._hookexec(self.name, self._hookimpls, kwargs, firstresult)
INTERNALERROR>            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/home/shh/miniconda3/envs/tmp_asyncio/lib/python3.11/site-packages/pluggy/_manager.py", line 115, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR>            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/home/shh/miniconda3/envs/tmp_asyncio/lib/python3.11/site-packages/pluggy/_callers.py", line 113, in _multicall
INTERNALERROR>     raise exception.with_traceback(exception.__traceback__)
INTERNALERROR>   File "/home/shh/miniconda3/envs/tmp_asyncio/lib/python3.11/site-packages/pluggy/_callers.py", line 77, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>           ^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/home/shh/miniconda3/envs/tmp_asyncio/lib/python3.11/site-packages/pytest_asyncio/plugin.py", line 612, in pytest_collectstart
INTERNALERROR>     pyobject = collector.obj
INTERNALERROR>                ^^^^^^^^^^^^^
INTERNALERROR>   File "/home/shh/miniconda3/envs/tmp_asyncio/lib/python3.11/site-packages/_pytest/python.py", line 310, in obj
INTERNALERROR>     self._obj = obj = self._getobj()
INTERNALERROR>                       ^^^^^^^^^^^^^^
INTERNALERROR>   File "/home/shh/miniconda3/envs/tmp_asyncio/lib/python3.11/site-packages/_pytest/python.py", line 528, in _getobj
INTERNALERROR>     return self._importtestmodule()
INTERNALERROR>            ^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/home/shh/miniconda3/envs/tmp_asyncio/lib/python3.11/site-packages/_pytest/python.py", line 617, in _importtestmodule
INTERNALERROR>     mod = import_path(self.path, mode=importmode, root=self.config.rootpath)
INTERNALERROR>           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/home/shh/miniconda3/envs/tmp_asyncio/lib/python3.11/site-packages/_pytest/pathlib.py", line 567, in import_path
INTERNALERROR>     importlib.import_module(module_name)
INTERNALERROR>   File "/home/shh/miniconda3/envs/tmp_asyncio/lib/python3.11/importlib/__init__.py", line 126, in import_module
INTERNALERROR>     return _bootstrap._gcd_import(name[level:], package, level)
INTERNALERROR>            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
INTERNALERROR>   File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
INTERNALERROR>   File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
INTERNALERROR>   File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
INTERNALERROR>   File "/home/shh/miniconda3/envs/tmp_asyncio/lib/python3.11/site-packages/_pytest/assertion/rewrite.py", line 186, in exec_module
INTERNALERROR>     exec(co, module.__dict__)
INTERNALERROR>   File "/home/shh/Downloads/tmp/test_example.py", line 6, in <module>
INTERNALERROR>     raise SkipTest("Could not import cuDF, skipping cuDFInterface tests.")
INTERNALERROR> unittest.case.SkipTest: Could not import cuDF, skipping cuDFInterface tests.
@seifertm seifertm added the bug label Dec 7, 2023
@seifertm seifertm added this to the v0.23.3 milestone Dec 7, 2023
@seifertm
Copy link
Contributor

seifertm commented Dec 9, 2023

@hoxbro Can you confirm that your issue is resolved with pytest-asyncio==0.23.3a0?

@hoxbro
Copy link
Author

hoxbro commented Dec 9, 2023

It does, thank you for the quick fix 👍

@gsakkis
Copy link

gsakkis commented Jan 12, 2024

I'm hitting this with pytest-asyncio==0.23.3

@seifertm
Copy link
Contributor

@gsakkis #747 may resolve your issue.

However, I cannot help without a a minimal runnable example that reproduces your error.

@gsakkis
Copy link

gsakkis commented Jan 15, 2024

@seifertm I confirm that #747 fixes it, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants