Skip to content

Commit d95abdf

Browse files
committed
Start file for parameterizing the array module
1 parent cb0f024 commit d95abdf

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

array_api_tests/_array_module.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import os
2+
from importlib import import_module
3+
4+
# Replace this with a specific array module to test it, for example,
5+
#
6+
# import numpy as array_module
7+
array_module = None
8+
9+
if array_module is None:
10+
if 'ARRAY_API_TESTS_MODULE' in os.environ:
11+
mod_name = os.environ['ARRAY_API_TESTS_MODULE']
12+
mod = import_module(mod_name)
13+
else:
14+
raise RuntimeError("No array module specified. Either edit _array_module.py or set the ARRAY_API_TESTS_MODULE environment variable")
15+
else:
16+
mod = array_module
17+
18+
# Names from the spec. This is what should actually be imported from this
19+
# file.
20+
21+
array = mod.array
22+
dtype = mod.dtype

0 commit comments

Comments
 (0)