File tree 1 file changed +13
-1
lines changed
1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change 9
9
def pytest_addoption (parser ):
10
10
parser .addoption (
11
11
'--disable-extension' ,
12
+ metavar = 'ext' ,
12
13
nargs = '+' ,
13
14
default = [],
14
15
help = 'disable testing for Array API extension(s)' ,
15
16
)
17
+ parser .addoption (
18
+ '--enable-extension' ,
19
+ metavar = 'ext' ,
20
+ nargs = '+' ,
21
+ default = [],
22
+ help = 'enable testing for Array API extension(s)' ,
23
+ )
16
24
17
25
18
26
def pytest_configure (config ):
@@ -31,6 +39,10 @@ def xp_has_ext(ext: str) -> bool:
31
39
32
40
def pytest_collection_modifyitems (config , items ):
33
41
disabled_exts = config .getoption ('--disable-extension' )
42
+ enabled_exts = config .getoption ('--enable-extension' )
43
+ for ext in disabled_exts :
44
+ if ext in enabled_exts :
45
+ raise ValueError (f'{ ext = } both enabled and disabled' )
34
46
for item in items :
35
47
try :
36
48
ext_mark = next (
@@ -41,5 +53,5 @@ def pytest_collection_modifyitems(config, items):
41
53
ext = ext_mark .args [0 ]
42
54
if ext in disabled_exts :
43
55
item .add_marker (mark .skip (reason = f'{ ext } disabled in --disable-extensions' ))
44
- elif not xp_has_ext (ext ):
56
+ elif not ext in enabled_exts and not xp_has_ext (ext ):
45
57
item .add_marker (mark .skip (reason = f'{ ext } not found in array module' ))
You can’t perform that action at this time.
0 commit comments