Skip to content

Commit e623d48

Browse files
fix the list issue
1 parent a3a815b commit e623d48

File tree

1 file changed

+40
-1
lines changed

1 file changed

+40
-1
lines changed

test/xpu/run_test_with_windows_nighltly.py

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,50 @@
44
from skip_list_common import skip_dict
55
from skip_list_win import skip_dict as skip_dict_win
66
from skip_list_win_lnl import skip_dict as skip_dict_win_lnl
7-
from xpu_test_utils import launch_test
87

98
res = 0
109
IS_WINDOWS = sys.platform == "win32"
1110

11+
def launch_test(test_case, skip_list=None, exe_list=None):
12+
os.environ["PYTORCH_TEST_WITH_SLOW"] = "1"
13+
module_name = test_case.replace(".py", "").replace("/", ".").replace("\\", ".")
14+
if skip_list is not None:
15+
if skip_list:
16+
skip_options = ' -k "not ' + skip_list[0]
17+
for skip_case in skip_list[1:]:
18+
skip_option = " and not " + skip_case
19+
skip_options += skip_option
20+
skip_options += '"'
21+
test_command = (
22+
f"pytest --junit-xml=./op_ut_with_skip.{module_name}.xml " + test_case
23+
)
24+
test_command += skip_options
25+
else:
26+
test_command = (
27+
f"pytest --junit-xml=./op_ut_with_all.{module_name}.xml " + test_case
28+
)
29+
elif exe_list is not None:
30+
if exe_list:
31+
exe_options = ' -k "' + exe_list[0]
32+
for exe_case in exe_list[1:]:
33+
exe_option = " or " + exe_case
34+
exe_options += exe_option
35+
exe_options += '"'
36+
test_command = (
37+
f"pytest --junit-xml=./op_ut_with_exe.{module_name}.xml " + test_case
38+
)
39+
test_command += exe_options
40+
else:
41+
test_command = (
42+
f"pytest --junit-xml=./op_ut_with_all.{module_name}.xml " + test_case
43+
)
44+
else:
45+
test_command = (
46+
f"pytest --junit-xml=./op_ut_with_all.{module_name}.xml " + test_case
47+
)
48+
return os.system(test_command)
49+
50+
1251
skip_files_list = [
1352
"test_autocast_xpu.py",
1453
"test_autograd_fallback_xpu.py",

0 commit comments

Comments
 (0)