Skip to content

Commit dfef8b4

Browse files
committed
Try inferring api_version from xp.__array_api_version__
1 parent 6ee7c3f commit dfef8b4

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

README.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,9 @@ library to fail.
163163
#### API version
164164

165165
You can specify the API version to use when testing via the
166-
ARRAY_API_TESTS_VERSION environment variable. Currently this defaults to
167-
`"2021.12"`.
166+
`ARRAY_API_TESTS_VERSION` environment variable. Currently this defaults to the
167+
array module's `__array_api_version__` value, and if that attribute doesn't
168+
exist then we fallback to `"2021.12"`.
168169

169170
#### CI flag
170171

array_api_tests/__init__.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ def _from_dtype(*a, **kw):
4646
pass
4747

4848

49-
api_version = getenv("ARRAY_API_TESTS_VERSION", "2021.12")
49+
api_version = getenv(
50+
"ARRAY_API_TESTS_VERSION", getattr(_xp, "__array_api_version__", "2021.12")
51+
)
5052
xps = array_api.make_strategies_namespace(_xp, api_version=api_version)
5153

5254
__version__ = _version.get_versions()["version"]

0 commit comments

Comments
 (0)