Closed
Description
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.