Skip to content

Commit

Permalink
Calling pytest from python code since skip list too long
Browse files Browse the repository at this point in the history
Signed-off-by: Cheng Penghui <[email protected]>
  • Loading branch information
PenghuiCheng committed Nov 4, 2024
1 parent f224138 commit fabd2ef
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 29 deletions.
9 changes: 4 additions & 5 deletions test/xpu/extended/run_test_with_skip.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import pytest
import sys
from skip_list_common import skip_dict
from skip_list_win import skip_dict as skip_dict_win
Expand All @@ -9,14 +10,12 @@
if IS_WINDOWS:
skip_list += skip_dict_win["test_ops_xpu.py"]

skip_options = " -k \"not " + skip_list[0]
skip_options = "not " + skip_list[0]
for skip_case in skip_list[1:]:
skip_option = " and not " + skip_case
skip_options += skip_option
skip_options += "\""

os.environ["PYTORCH_TEST_WITH_SLOW"]="1"
test_command = "pytest -v test_ops_xpu.py"
test_command += skip_options
res = os.system(test_command)
test_command = ["-k", skip_options, "test_ops_xpu.py", "-v"]
res = pytest.main(test_command)
sys.exit(res)
9 changes: 4 additions & 5 deletions test/xpu/extended/run_test_with_skip_arc.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import pytest
import sys
from skip_list_common import skip_dict
from skip_list_arc import skip_dict as skip_dict_specifical
Expand All @@ -11,14 +12,12 @@
if IS_WINDOWS:
skip_list += skip_dict_win["test_ops_xpu.py"] + skip_dict_win_arc["test_ops_xpu.py"]

skip_options = " -k \"not " + skip_list[0]
skip_options = "not " + skip_list[0]
for skip_case in skip_list[1:]:
skip_option = " and not " + skip_case
skip_options += skip_option
skip_options += "\""

os.environ["PYTORCH_TEST_WITH_SLOW"]="1"
test_command = "pytest -v test_ops_xpu.py"
test_command += skip_options
res = os.system(test_command)
test_command = ["-k", skip_options, "test_ops_xpu.py", "-v"]
res = pytest.main(test_command)
sys.exit(res)
52 changes: 52 additions & 0 deletions test/xpu/skip_list_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"test_dtypes_nn_functional_conv_transpose3d_xpu",
"test_dtypes_nn_functional_softsign_xpu",
"test_dtypes_sparse_sampled_addmm_xpu",
"test_dtypes__upsample_bilinear2d_aa_xpu",
# AssertionError: RuntimeError not raised
"test_errors_dot_xpu",
"test_errors_kthvalue_xpu",
Expand Down Expand Up @@ -682,6 +683,57 @@

# NotImplementedError: The operator 'aten::_assert_async.msg' is not currently implemented for the XPU device.
"test_view_replay_multinomial_xpu_float32",
"test_noncontiguous_samples__upsample_bilinear2d_aa_xpu_float32",
"test_noncontiguous_samples_histogramdd_xpu_float32",
"test_out_fft_irfft_xpu_float32",
"test_out_fft_rfft2_xpu_float32",
"test_out_fft_rfft_xpu_float32",
"test_out_fft_rfftn_xpu_float32",
"test_out_histogramdd_xpu_float32",
"test_out_linalg_eig_xpu_float32",
"test_out_linalg_eigvals_xpu_float32",
"test_out_linalg_householder_product_xpu_float32",
"test_out_linalg_solve_triangular_xpu_float32",
"test_out_logcumsumexp_xpu_float32",
"test_out_min_reduction_no_dim_xpu_float32",
"test_out_mvlgamma_mvlgamma_p_1_xpu_float32",
"test_out_mvlgamma_mvlgamma_p_3_xpu_float32",
"test_out_mvlgamma_mvlgamma_p_5_xpu_float32",
"test_out_requires_grad_error_linalg_eigvals_xpu_float32",
"test_out_std_xpu_float32",
"test_out_warning_cholesky_inverse_xpu",
"test_out_warning_cholesky_xpu",
"test_out_warning_fft_fft2_xpu",
"test_out_warning_fft_fft_xpu",
"test_out_warning_fft_fftn_xpu",
"test_out_warning_fft_hfft2_xpu",
"test_out_warning_fft_hfft_xpu",
"test_out_warning_fft_hfftn_xpu",
"test_out_warning_fft_ifft2_xpu",
"test_out_warning_fft_ifftn_xpu",
"test_out_warning_fft_irfft2_xpu",
"test_out_warning_fft_irfft_xpu",
"test_out_warning_fft_irfftn_xpu",
"test_out_warning_fft_rfft2_xpu",
"test_out_warning_fft_rfft_xpu",
"test_out_warning_fft_rfftn_xpu",
"test_out_warning_geqrf_xpu",
"test_out_warning_histogramdd_xpu",
"test_out_warning_linalg_eig_xpu",
"test_out_warning_linalg_eigvals_xpu",
"test_out_warning_linalg_householder_product_xpu",
"test_out_warning_linalg_solve_triangular_xpu",
"test_out_warning_logcumsumexp_xpu",
"test_out_warning_min_reduction_no_dim_xpu",
"test_out_warning_mvlgamma_mvlgamma_p_1_xpu",
"test_out_warning_mvlgamma_mvlgamma_p_3_xpu",
"test_out_warning_mvlgamma_mvlgamma_p_5_xpu",
"test_out_warning_ormqr_xpu",
"test_out_warning_std_xpu",
"test_variant_consistency_eager__upsample_bilinear2d_aa_xpu_float32",
"test_variant_consistency_eager_histogramdd_xpu_float32",
"test_variant_consistency_eager_nn_functional_grid_sample_xpu_float32",
"test_neg_view_histogramdd_xpu_float64",

# AssertionError: The supported dtypes for nn.functional.max_unpool3d on device type xpu are incorrect!
# The following dtypes worked in forward but are not listed by the OpInfo: {torch.uint8, torch.int8, torch.int16, torch.int32, torch.int64}.
Expand Down
3 changes: 3 additions & 0 deletions test/xpu/skip_list_mtl.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
skip_dict = {
"test_ops_xpu.py": (
"test_non_standard_bool_values_index_put_xpu_bool",
),
"test_indexing_xpu.py": (
"test_index_put_accumulate_large_tensor_xpu",
),
Expand Down
26 changes: 7 additions & 19 deletions test/xpu/xpu_test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import copy
import os
import pytest
import sys
import unittest

Expand Down Expand Up @@ -1019,30 +1020,17 @@ def launch_test(test_case, skip_list=None, exe_list=None):
os.environ["PYTORCH_ENABLE_XPU_FALLBACK"]="1"
os.environ["PYTORCH_TEST_WITH_SLOW"]="1"
if skip_list != None:
skip_options = " -k \"not " + skip_list[0]
skip_options = " not " + skip_list[0]
for skip_case in skip_list[1:]:
skip_option = " and not " + skip_case
skip_options += skip_option
skip_options += "\""
test_command = (
"pytest -v "
+ test_case
)
test_command += skip_options
test_command = ["-k", skip_options, test_case, "-v"]
elif exe_list != None:
exe_options = " -k \"" + exe_list[0]
exe_options = exe_list[0]
for exe_case in exe_list[1:]:
exe_option = " or " + exe_case
exe_options += exe_option
exe_options += "\""
test_command = (
"pytest -v "
+ test_case
)
test_command += exe_options
test_command = ["-k", exe_options, test_case, "-v"]
else:
test_command = (
"pytest -v "
+ test_case
)
return os.system(test_command)
test_command = [test_case, "-v"]
return pytest.main(test_command)

0 comments on commit fabd2ef

Please sign in to comment.