Skip to content

Commit 6f8e524

Browse files
authored
expand tests for parameter selection (#23)
Before #20 we had partial tests for parameter selection. This re-adds and expands them.
1 parent b9297f2 commit 6f8e524

File tree

2 files changed

+79
-0
lines changed

2 files changed

+79
-0
lines changed

tests/assets/test_op_infos.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ class TestFoo(TestCase):
3030
@ops(
3131
[
3232
OpInfo("add", dtypes=dtypes),
33+
OpInfo("add", variant_test_name="with_alpha", dtypes=dtypes),
3334
OpInfo("sub", dtypes=dtypes),
35+
OpInfo("sub", variant_test_name="with_alpha", dtypes=dtypes),
3436
]
3537
)
3638
def test_bar(self, device, dtype, op):

tests/test_plugin.py

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,83 @@ def test_standard_collection(collect_tests, file, cmds, selection):
7474
assert collection == selection
7575

7676

77+
@make_parametrization(
78+
Config(
79+
new_cmds=("-k", "cpu"),
80+
legacy_cmds=("-k", "cpu"),
81+
selection=(
82+
"::TestFooCPU::test_bar_cpu",
83+
"::TestFooCPU::test_baz_cpu",
84+
"::TestSpamCPU::test_ham_cpu",
85+
"::TestSpamCPU::test_eggs_cpu",
86+
"::TestQuxCPU::test_quux_cpu",
87+
),
88+
),
89+
Config(
90+
new_cmds=("-k", "meta"),
91+
legacy_cmds=("-k", "meta"),
92+
selection=(
93+
"::TestFooMETA::test_bar_meta",
94+
"::TestFooMETA::test_baz_meta",
95+
"::TestSpamMETA::test_ham_meta",
96+
"::TestSpamMETA::test_eggs_meta",
97+
),
98+
),
99+
file="test_device.py",
100+
)
101+
def test_devices(collect_tests, file, cmds, selection):
102+
collection = collect_tests(file, cmds)
103+
assert collection == selection
104+
105+
106+
@make_parametrization(
107+
Config(
108+
new_cmds=("-k", "float16"),
109+
legacy_cmds=("-k", "float16"),
110+
selection=(
111+
"::TestFooCPU::test_bar_cpu_float16",
112+
"::TestFooCPU::test_bar_cpu_float16",
113+
),
114+
),
115+
Config(
116+
new_cmds=("-k", "int32"),
117+
legacy_cmds=("-k", "int32"),
118+
selection=(
119+
"::TestFooCPU::test_bar_cpu_int32",
120+
"::TestFooCPU::test_bar_cpu_int32",
121+
),
122+
),
123+
file="test_dtype.py",
124+
)
125+
def test_dtypes(collect_tests, file, cmds, selection):
126+
collection = collect_tests(file, cmds)
127+
assert collection == selection
128+
129+
130+
@make_parametrization(
131+
Config(
132+
new_cmds=("-k", "add"),
133+
legacy_cmds=("-k", "add"),
134+
selection=(
135+
"::TestFooCPU::test_bar_add_cpu_float32",
136+
"::TestFooCPU::test_bar_add_with_alpha_cpu_float32",
137+
),
138+
),
139+
Config(
140+
new_cmds=("-k", "sub"),
141+
legacy_cmds=("-k", "sub"),
142+
selection=(
143+
"::TestFooCPU::test_bar_sub_cpu_float32",
144+
"::TestFooCPU::test_bar_sub_with_alpha_cpu_float32",
145+
),
146+
),
147+
file="test_op_infos.py",
148+
)
149+
def test_op_infos(collect_tests, file, cmds, selection):
150+
collection = collect_tests(file, cmds)
151+
assert collection == selection
152+
153+
77154
@make_parametrization(
78155
Config(
79156
selection=(

0 commit comments

Comments
 (0)