We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent bdb4df0 commit 5eaf84eCopy full SHA for 5eaf84e
tests/test_at.py
@@ -1,7 +1,6 @@
1
from collections.abc import Callable, Generator
2
from contextlib import contextmanager
3
from enum import Enum
4
-from importlib import import_module
5
from typing import cast
6
7
import numpy as np
@@ -40,12 +39,8 @@ def array(request: pytest.FixtureRequest) -> Array:
40
39
x = np.asarray([10.0, 20.0, 30.0])
41
x.flags.writeable = False
42
else:
43
- library_name = library.value
44
- try:
45
- lib = import_module(library_name)
46
- except ImportError:
47
- pytest.skip(f"{library_name} is not installed")
48
- x = lib.asarray([10.0, 20.0, 30.0])
+ xp = pytest.importorskip(library.value)
+ x = xp.asarray([10.0, 20.0, 30.0])
49
return x
50
51
0 commit comments