You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by ar...@apache.org on 2022/05/23 18:52:29 UTC
[tvm] branch main updated: [tests] add utility to replace direct call to pytest.main (#11393)
This is an automated email from the ASF dual-hosted git repository.
areusch pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git
The following commit(s) were added to refs/heads/main by this push:
new 553eb1acd0 [tests] add utility to replace direct call to pytest.main (#11393)
553eb1acd0 is described below
commit 553eb1acd0c115adea0c7d04ce36e26332339769
Author: Florin Blanaru <fl...@gmail.com>
AuthorDate: Mon May 23 21:52:22 2022 +0300
[tests] add utility to replace direct call to pytest.main (#11393)
---
python/tvm/testing/utils.py | 6 ++++++
tests/micro/arduino/test_arduino_error_detection.py | 3 ++-
tests/micro/arduino/test_arduino_rpc_server.py | 3 ++-
tests/micro/arduino/test_arduino_workflow.py | 4 +++-
tests/micro/common/test_tvmc.py | 3 ++-
tests/micro/zephyr/test_zephyr.py | 3 ++-
tests/micro/zephyr/test_zephyr_aot.py | 2 +-
tests/micro/zephyr/test_zephyr_armv7m.py | 2 +-
tests/python/ci/test_ci.py | 3 ++-
tests/python/contrib/test_cmsisnn/test_binary_ops.py | 2 +-
tests/python/contrib/test_cmsisnn/test_conv2d.py | 2 +-
tests/python/contrib/test_cmsisnn/test_extract_constants.py | 3 ++-
tests/python/contrib/test_cmsisnn/test_fully_connected.py | 2 +-
tests/python/contrib/test_cmsisnn/test_generate_constants.py | 3 ++-
tests/python/contrib/test_cmsisnn/test_networks.py | 2 +-
tests/python/contrib/test_cmsisnn/test_pooling.py | 4 +---
tests/python/contrib/test_cmsisnn/test_scalar_to_tensor_constant.py | 3 ++-
tests/python/contrib/test_cmsisnn/test_softmax.py | 2 +-
tests/python/contrib/test_cudnn.py | 3 ++-
tests/python/contrib/test_dnnl.py | 4 +---
tests/python/contrib/test_hexagon/conv2d/test_conv2d_blocked.py | 3 ++-
tests/python/contrib/test_hexagon/conv2d/test_conv2d_conv2d.py | 3 ++-
tests/python/contrib/test_hexagon/test_2d_physical_buffers.py | 2 +-
tests/python/contrib/test_hexagon/test_launcher.py | 2 +-
tests/python/contrib/test_hexagon/test_maxpool2d_blocked.py | 3 ++-
tests/python/contrib/test_hexagon/test_models.py | 2 +-
tests/python/contrib/test_hexagon/test_usmp.py | 2 +-
tests/python/contrib/test_hexagon/topi/test_batch_matmul.py | 3 ++-
tests/python/contrib/test_hexagon/topi/test_conv2d_nchw.py | 3 ++-
tests/python/contrib/test_hexagon/topi/test_conv2d_nhwc.py | 3 ++-
tests/python/contrib/test_hexagon/topi/test_dense.py | 3 ++-
tests/python/contrib/test_hexagon/topi/test_pooling.py | 3 ++-
tests/python/contrib/test_hexagon/topi/test_reduce.py | 3 ++-
tests/python/contrib/test_hexagon/topi/test_softmax.py | 3 ++-
tests/python/contrib/test_rpc_server_device.py | 2 +-
tests/python/contrib/test_tensorrt.py | 4 +---
tests/python/contrib/test_verilator/test_verilator_ops.py | 5 ++---
tests/python/driver/tvmc/test_compiler.py | 4 +---
tests/python/driver/tvmc/test_mlf.py | 3 ++-
tests/python/driver/tvmc/test_target.py | 5 ++---
tests/python/integration/test_arm_mprofile_dsp.py | 2 +-
tests/python/integration/test_tuning.py | 2 +-
tests/python/relay/aot/test_c_device_api.py | 3 ++-
tests/python/relay/aot/test_cpp_aot.py | 2 +-
tests/python/relay/aot/test_crt_aot.py | 2 +-
tests/python/relay/aot/test_crt_aot_usmp.py | 5 +----
tests/python/relay/dyn/test_dynamic_op_level10.py | 5 +----
tests/python/relay/dyn/test_dynamic_op_level3.py | 4 +---
tests/python/relay/op/annotation/test_annotation.py | 5 ++---
tests/python/relay/op/test_tensor.py | 5 ++---
tests/python/relay/strategy/arm_cpu/test_conv2d_nchw.py | 2 +-
tests/python/relay/strategy/arm_cpu/test_conv2d_nhwc.py | 2 +-
tests/python/relay/strategy/arm_cpu/test_depthwise_conv2d.py | 2 +-
tests/python/relay/strategy/arm_cpu/test_group_conv2d.py | 2 +-
tests/python/relay/test_any.py | 6 ++----
tests/python/relay/test_auto_scheduler_layout_rewrite_networks.py | 2 +-
tests/python/relay/test_build_module.py | 5 ++---
tests/python/relay/test_external_codegen.py | 3 ++-
tests/python/relay/test_ir_parser.py | 5 ++---
tests/python/relay/test_ir_structural_equal_hash.py | 6 ++----
tests/python/relay/test_ir_text_printer.py | 6 ++----
tests/python/relay/test_op_grad_level1.py | 2 +-
tests/python/relay/test_op_grad_level10.py | 2 +-
tests/python/relay/test_op_level10.py | 2 +-
tests/python/relay/test_op_level2.py | 2 +-
tests/python/relay/test_op_level3.py | 2 +-
tests/python/relay/test_op_level4.py | 2 +-
tests/python/relay/test_op_level5.py | 2 +-
tests/python/relay/test_op_qnn_unary_elementwise.py | 5 ++---
tests/python/relay/test_pass_annotate_spans_defuse.py | 5 +----
tests/python/relay/test_pass_dead_code_elimination.py | 5 ++---
tests/python/relay/test_pass_fake_quantization_to_integer.py | 5 ++---
tests/python/relay/test_pass_flatten_atrous_conv.py | 5 ++---
tests/python/relay/test_pass_fold_constant.py | 6 ++----
tests/python/relay/test_pass_lazy_gradient_init.py | 5 +----
tests/python/relay/test_pass_manifest_lifetimes.py | 3 ++-
tests/python/relay/test_pass_partial_eval.py | 6 ++----
tests/python/relay/test_pass_plan_devices.py | 5 +----
tests/python/relay/test_pass_to_a_normal_form.py | 3 ++-
tests/python/relay/test_pass_to_cps.py | 6 ++----
tests/python/relay/test_prng.py | 4 +---
tests/python/relay/test_relay_te_compiler.py | 1 -
tests/python/relay/test_target_hooks.py | 3 ++-
tests/python/relay/test_vm.py | 4 +---
tests/python/target/test_virtual_device.py | 6 ++----
tests/python/tir/analysis/test_device_constraint_utils.py | 6 ++----
tests/python/topi/python/test_topi_conv1d_transpose_ncw.py | 2 +-
tests/python/topi/python/test_topi_conv2d_int8.py | 2 +-
tests/python/topi/python/test_topi_conv2d_nchw.py | 2 +-
tests/python/topi/python/test_topi_conv2d_nhwc.py | 2 +-
tests/python/topi/python/test_topi_correlation.py | 3 ++-
tests/python/topi/python/test_topi_dense.py | 2 +-
tests/python/topi/python/test_topi_depthwise_conv2d.py | 2 +-
tests/python/topi/python/test_topi_loss.py | 2 +-
tests/python/topi/python/test_topi_math.py | 2 +-
tests/python/topi/python/test_topi_reduce.py | 2 +-
tests/python/topi/python/test_topi_relu.py | 2 +-
tests/python/topi/python/test_topi_softmax.py | 2 +-
tests/python/topi/python/test_topi_sort.py | 2 +-
tests/python/topi/python/test_topi_unique.py | 2 +-
tests/python/topi/python/test_topi_vision.py | 2 +-
tests/python/unittest/test_auto_scheduler_measure.py | 5 +----
tests/python/unittest/test_auto_scheduler_sketch_generation.py | 2 +-
tests/python/unittest/test_crt.py | 2 +-
tests/python/unittest/test_gen_requirements.py | 3 ++-
tests/python/unittest/test_index_map.py | 3 ++-
tests/python/unittest/test_link_params.py | 2 +-
tests/python/unittest/test_meta_schedule_builder.py | 3 ++-
tests/python/unittest/test_meta_schedule_byoc_tensorrt.py | 3 ++-
tests/python/unittest/test_meta_schedule_cost_model.py | 3 ++-
tests/python/unittest/test_meta_schedule_database.py | 3 ++-
.../test_meta_schedule_feature_extractor_per_store_feature.py | 3 ++-
tests/python/unittest/test_meta_schedule_integration.py | 2 +-
tests/python/unittest/test_meta_schedule_post_order_apply.py | 3 ++-
.../python/unittest/test_meta_schedule_postproc_verify_gpu_code.py | 3 ++-
tests/python/unittest/test_meta_schedule_runner.py | 2 +-
tests/python/unittest/test_meta_schedule_search_strategy.py | 3 ++-
tests/python/unittest/test_meta_schedule_space_generator.py | 3 ++-
tests/python/unittest/test_meta_schedule_task_scheduler.py | 3 ++-
tests/python/unittest/test_meta_schedule_tune_context.py | 3 ++-
tests/python/unittest/test_micro_model_library_format.py | 4 +---
tests/python/unittest/test_micro_project_api.py | 3 ++-
tests/python/unittest/test_micro_transport.py | 2 +-
tests/python/unittest/test_node_reflection.py | 3 ++-
tests/python/unittest/test_runtime_graph_debug.py | 2 +-
tests/python/unittest/test_runtime_profiling.py | 5 +----
tests/python/unittest/test_runtime_rpc.py | 2 +-
tests/python/unittest/test_runtime_vm_profiler.py | 6 ++----
tests/python/unittest/test_target_codegen_bool.py | 3 ++-
tests/python/unittest/test_target_codegen_hexagon.py | 2 +-
tests/python/unittest/test_target_codegen_llvm.py | 2 +-
tests/python/unittest/test_target_codegen_vulkan.py | 4 +---
tests/python/unittest/test_target_target.py | 3 ++-
tests/python/unittest/test_target_texture_codegen_opencl.py | 3 ++-
tests/python/unittest/test_tir_analysis_estimate_tir_flops.py | 3 ++-
tests/python/unittest/test_tir_renew_defs.py | 3 ++-
tests/python/unittest/test_tir_schedule_block_scope.py | 3 ++-
tests/python/unittest/test_tir_schedule_blockize.py | 3 ++-
tests/python/unittest/test_tir_schedule_cache_read_write.py | 3 ++-
tests/python/unittest/test_tir_schedule_compute_at.py | 3 ++-
tests/python/unittest/test_tir_schedule_compute_inline.py | 3 ++-
tests/python/unittest/test_tir_schedule_error.py | 3 ++-
tests/python/unittest/test_tir_schedule_for_kind.py | 2 +-
tests/python/unittest/test_tir_schedule_instruction.py | 3 ++-
tests/python/unittest/test_tir_schedule_reduction.py | 2 +-
tests/python/unittest/test_tir_schedule_reorder.py | 3 ++-
tests/python/unittest/test_tir_schedule_rfactor.py | 2 +-
tests/python/unittest/test_tir_schedule_sampling.py | 3 ++-
tests/python/unittest/test_tir_schedule_set_axis_separator.py | 3 ++-
tests/python/unittest/test_tir_schedule_split_fuse.py | 3 ++-
tests/python/unittest/test_tir_schedule_state.py | 3 ++-
tests/python/unittest/test_tir_schedule_state_cached_flags.py | 3 ++-
tests/python/unittest/test_tir_schedule_tensorize.py | 2 +-
tests/python/unittest/test_tir_schedule_trace.py | 3 ++-
tests/python/unittest/test_tir_schedule_transform_layout.py | 3 ++-
tests/python/unittest/test_tir_schedule_utilities.py | 3 ++-
tests/python/unittest/test_tir_texture_scope.py | 3 ++-
tests/python/unittest/test_tir_transform_compact_buffer_region.py | 3 ++-
.../python/unittest/test_tir_transform_inject_software_pipeline.py | 3 ++-
.../unittest/test_tir_transform_lower_cross_thread_reduction.py | 3 ++-
tests/python/unittest/test_tir_transform_storage_flatten.py | 3 ++-
tests/python/unittest/test_tir_transform_storage_rewrite.py | 3 ++-
tests/python/unittest/test_tir_transform_unify_thread_binding.py | 3 ++-
tests/python/unittest/test_tir_usmp_algo_hill_climb.py | 3 ++-
tests/python/unittest/test_transform_layout.py | 2 +-
tests/python/unittest/test_tvm_testing_features.py | 2 +-
tests/python/unittest/test_tvmscript_error_report.py | 2 +-
tests/python/unittest/test_tvmscript_roundtrip.py | 2 +-
tests/python/unittest/test_tvmscript_syntax_sugar.py | 3 ++-
169 files changed, 265 insertions(+), 254 deletions(-)
diff --git a/python/tvm/testing/utils.py b/python/tvm/testing/utils.py
index 8be5cc8ec4..0e2d7be4a1 100644
--- a/python/tvm/testing/utils.py
+++ b/python/tvm/testing/utils.py
@@ -62,6 +62,7 @@ function in this module. Then targets using this node should be added to the
`TVM_TEST_TARGETS` environment variable in the CI.
"""
+import inspect
import copy
import copyreg
import ctypes
@@ -1513,3 +1514,8 @@ def identity_after(x, sleep):
def terminate_self():
"""Testing function to terminate the process."""
sys.exit(-1)
+
+
+def main():
+ test_file = inspect.getsourcefile(sys._getframe(1))
+ sys.exit(pytest.main([test_file] + sys.argv[1:]))
diff --git a/tests/micro/arduino/test_arduino_error_detection.py b/tests/micro/arduino/test_arduino_error_detection.py
index 9db59b9259..583f8283ca 100644
--- a/tests/micro/arduino/test_arduino_error_detection.py
+++ b/tests/micro/arduino/test_arduino_error_detection.py
@@ -21,6 +21,7 @@ import pytest
from tvm.micro.project_api.server import ServerError
import test_utils
+import tvm.testing
# A new project and workspace dir is created for EVERY test
@pytest.fixture
@@ -46,4 +47,4 @@ def test_bugged_project_compile_fails(workspace_dir, project):
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/micro/arduino/test_arduino_rpc_server.py b/tests/micro/arduino/test_arduino_rpc_server.py
index 1dd20597ac..acd4186940 100644
--- a/tests/micro/arduino/test_arduino_rpc_server.py
+++ b/tests/micro/arduino/test_arduino_rpc_server.py
@@ -29,6 +29,7 @@ import onnx
import pytest
import tvm
+import tvm.testing
from PIL import Image
from tvm import relay
from tvm.relay.testing import byoc
@@ -367,4 +368,4 @@ def test_rpc_large_array(board, arduino_cli_cmd, tvm_debug, workspace_dir, shape
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/micro/arduino/test_arduino_workflow.py b/tests/micro/arduino/test_arduino_workflow.py
index d566a44c07..01bdaeb7b3 100644
--- a/tests/micro/arduino/test_arduino_workflow.py
+++ b/tests/micro/arduino/test_arduino_workflow.py
@@ -21,6 +21,8 @@ import shutil
import sys
import pytest
+import tvm.testing
+
import test_utils
"""
@@ -218,4 +220,4 @@ def test_project_inference_runtime(serial_output):
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/micro/common/test_tvmc.py b/tests/micro/common/test_tvmc.py
index a3e8a9e8b5..24d0213b77 100644
--- a/tests/micro/common/test_tvmc.py
+++ b/tests/micro/common/test_tvmc.py
@@ -26,6 +26,7 @@ import os
import shutil
import tvm
+import tvm.testing
from tvm.contrib.download import download_testdata
from ..zephyr.test_utils import ZEPHYR_BOARDS
@@ -217,4 +218,4 @@ def test_tvmc_model_run(board, output_dir):
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/micro/zephyr/test_zephyr.py b/tests/micro/zephyr/test_zephyr.py
index 49e5e2757b..f89d11cf44 100644
--- a/tests/micro/zephyr/test_zephyr.py
+++ b/tests/micro/zephyr/test_zephyr.py
@@ -26,6 +26,7 @@ import onnx
from PIL import Image
import tvm
+import tvm.testing
import tvm.relay as relay
from tvm.relay.backend import Executor, Runtime
from tvm.relay.testing import byoc
@@ -504,4 +505,4 @@ def test_autotune_conv2d(temp_dir, board, west_cmd, tvm_debug):
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/micro/zephyr/test_zephyr_aot.py b/tests/micro/zephyr/test_zephyr_aot.py
index 6b355f28de..cfe2ce2ae3 100644
--- a/tests/micro/zephyr/test_zephyr_aot.py
+++ b/tests/micro/zephyr/test_zephyr_aot.py
@@ -135,4 +135,4 @@ def test_qemu_make_fail(temp_dir, board, west_cmd, tvm_debug):
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/micro/zephyr/test_zephyr_armv7m.py b/tests/micro/zephyr/test_zephyr_armv7m.py
index 47b78994e0..2631e43799 100644
--- a/tests/micro/zephyr/test_zephyr_armv7m.py
+++ b/tests/micro/zephyr/test_zephyr_armv7m.py
@@ -187,4 +187,4 @@ def test_armv7m_intrinsic(temp_dir, board, west_cmd, tvm_debug):
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/ci/test_ci.py b/tests/python/ci/test_ci.py
index e197d7e48a..f5297c7ae7 100644
--- a/tests/python/ci/test_ci.py
+++ b/tests/python/ci/test_ci.py
@@ -20,6 +20,7 @@ import sys
import json
import textwrap
import pytest
+import tvm.testing
from test_utils import REPO_ROOT
@@ -732,4 +733,4 @@ def test_github_tag_teams(tmpdir_factory):
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/contrib/test_cmsisnn/test_binary_ops.py b/tests/python/contrib/test_cmsisnn/test_binary_ops.py
index 7846bba1e0..49c7687015 100644
--- a/tests/python/contrib/test_cmsisnn/test_binary_ops.py
+++ b/tests/python/contrib/test_cmsisnn/test_binary_ops.py
@@ -275,4 +275,4 @@ def test_invalid_parameters(
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/contrib/test_cmsisnn/test_conv2d.py b/tests/python/contrib/test_cmsisnn/test_conv2d.py
index 1cdf985101..439a3ec39c 100644
--- a/tests/python/contrib/test_cmsisnn/test_conv2d.py
+++ b/tests/python/contrib/test_cmsisnn/test_conv2d.py
@@ -512,4 +512,4 @@ def test_invalid_parameters(
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/contrib/test_cmsisnn/test_extract_constants.py b/tests/python/contrib/test_cmsisnn/test_extract_constants.py
index 8e25177771..789d400faf 100644
--- a/tests/python/contrib/test_cmsisnn/test_extract_constants.py
+++ b/tests/python/contrib/test_cmsisnn/test_extract_constants.py
@@ -21,6 +21,7 @@ import math
import numpy as np
import pytest
import tvm
+import tvm.testing
from tvm import relay
tvm._ffi._init_api("relay.ext.cmsisnn.transform", __name__)
@@ -224,4 +225,4 @@ def test_multiple_functions_non_cmsisnn_compiler(external_compiler):
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/contrib/test_cmsisnn/test_fully_connected.py b/tests/python/contrib/test_cmsisnn/test_fully_connected.py
index 111d3b2eda..c5d97f807b 100644
--- a/tests/python/contrib/test_cmsisnn/test_fully_connected.py
+++ b/tests/python/contrib/test_cmsisnn/test_fully_connected.py
@@ -234,4 +234,4 @@ def test_invalid_parameters(
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/contrib/test_cmsisnn/test_generate_constants.py b/tests/python/contrib/test_cmsisnn/test_generate_constants.py
index 1f6c763815..cded0f0356 100644
--- a/tests/python/contrib/test_cmsisnn/test_generate_constants.py
+++ b/tests/python/contrib/test_cmsisnn/test_generate_constants.py
@@ -21,6 +21,7 @@ import math
import numpy as np
import pytest
import tvm
+import tvm.testing
from tvm import relay
from tvm.relay.op.contrib import cmsisnn
@@ -225,4 +226,4 @@ def test_op_int8(
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/contrib/test_cmsisnn/test_networks.py b/tests/python/contrib/test_cmsisnn/test_networks.py
index fefce9e86c..3b1e2331f2 100644
--- a/tests/python/contrib/test_cmsisnn/test_networks.py
+++ b/tests/python/contrib/test_cmsisnn/test_networks.py
@@ -117,4 +117,4 @@ def test_cnn_small(test_runner):
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/contrib/test_cmsisnn/test_pooling.py b/tests/python/contrib/test_cmsisnn/test_pooling.py
index a2650bb8d0..1fd280b7d8 100644
--- a/tests/python/contrib/test_cmsisnn/test_pooling.py
+++ b/tests/python/contrib/test_cmsisnn/test_pooling.py
@@ -169,6 +169,4 @@ def test_invalid_layout(op):
if __name__ == "__main__":
- import sys
-
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/contrib/test_cmsisnn/test_scalar_to_tensor_constant.py b/tests/python/contrib/test_cmsisnn/test_scalar_to_tensor_constant.py
index 9c665053e2..35bdabf317 100644
--- a/tests/python/contrib/test_cmsisnn/test_scalar_to_tensor_constant.py
+++ b/tests/python/contrib/test_cmsisnn/test_scalar_to_tensor_constant.py
@@ -21,6 +21,7 @@ import sys
import numpy as np
import pytest
import tvm
+import tvm.testing
from tvm import relay
tvm._ffi._init_api("relay.ext.cmsisnn.transform", __name__)
@@ -286,4 +287,4 @@ def test_non_cmsisnn_ext_func():
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/contrib/test_cmsisnn/test_softmax.py b/tests/python/contrib/test_cmsisnn/test_softmax.py
index 5a44a7865e..840d0e6f44 100644
--- a/tests/python/contrib/test_cmsisnn/test_softmax.py
+++ b/tests/python/contrib/test_cmsisnn/test_softmax.py
@@ -129,4 +129,4 @@ def test_invalid_parameters(in_dtype, out_dtype, zero_point, scale, out_zero_poi
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/contrib/test_cudnn.py b/tests/python/contrib/test_cudnn.py
index cdbe424710..794a3d872d 100644
--- a/tests/python/contrib/test_cudnn.py
+++ b/tests/python/contrib/test_cudnn.py
@@ -20,6 +20,7 @@ import sys
import pytest
import tvm
+import tvm.testing
from tvm import te
from tvm import relay
from tvm.contrib import cudnn
@@ -623,4 +624,4 @@ def test_relay_cudnn_conv2d_bias_act(
if __name__ == "__main__":
- sys.exit(pytest.main(sys.argv))
+ tvm.testing.main()
diff --git a/tests/python/contrib/test_dnnl.py b/tests/python/contrib/test_dnnl.py
index df3f64946f..5baf6e06d3 100755
--- a/tests/python/contrib/test_dnnl.py
+++ b/tests/python/contrib/test_dnnl.py
@@ -985,6 +985,4 @@ def test_prune_dnnl_subgraph(run_module):
if __name__ == "__main__":
- import sys
-
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/contrib/test_hexagon/conv2d/test_conv2d_blocked.py b/tests/python/contrib/test_hexagon/conv2d/test_conv2d_blocked.py
index 6762db85e6..c5df89b315 100644
--- a/tests/python/contrib/test_hexagon/conv2d/test_conv2d_blocked.py
+++ b/tests/python/contrib/test_hexagon/conv2d/test_conv2d_blocked.py
@@ -19,6 +19,7 @@ import sys
import platform
import tvm
+import tvm.testing
from tvm import te
from tvm import topi
from tvm.topi import testing
@@ -191,4 +192,4 @@ class TestConv2dPackedFilter(BaseConv2d):
if __name__ == "__main__":
- sys.exit(pytest.main(sys.argv))
+ tvm.testing.main()
diff --git a/tests/python/contrib/test_hexagon/conv2d/test_conv2d_conv2d.py b/tests/python/contrib/test_hexagon/conv2d/test_conv2d_conv2d.py
index 437bdb750b..460c824c70 100644
--- a/tests/python/contrib/test_hexagon/conv2d/test_conv2d_conv2d.py
+++ b/tests/python/contrib/test_hexagon/conv2d/test_conv2d_conv2d.py
@@ -19,6 +19,7 @@ import sys
import platform
import tvm
+import tvm.testing
from tvm import te
from tvm import topi
from tvm.topi import testing
@@ -236,4 +237,4 @@ class TestConv2dConv2dPackedFilter(BaseConv2dConv2d):
if __name__ == "__main__":
- sys.exit(pytest.main(sys.argv))
+ tvm.testing.main()
diff --git a/tests/python/contrib/test_hexagon/test_2d_physical_buffers.py b/tests/python/contrib/test_hexagon/test_2d_physical_buffers.py
index 787d71fa17..e9fd246564 100644
--- a/tests/python/contrib/test_hexagon/test_2d_physical_buffers.py
+++ b/tests/python/contrib/test_hexagon/test_2d_physical_buffers.py
@@ -336,4 +336,4 @@ class TestElementWise:
if __name__ == "__main__":
- sys.exit(pytest.main(sys.argv))
+ tvm.testing.main()
diff --git a/tests/python/contrib/test_hexagon/test_launcher.py b/tests/python/contrib/test_hexagon/test_launcher.py
index 5c5e8f6c39..ad798925ee 100644
--- a/tests/python/contrib/test_hexagon/test_launcher.py
+++ b/tests/python/contrib/test_hexagon/test_launcher.py
@@ -388,4 +388,4 @@ def test_aot_executor_multiple_conv2d(hexagon_session: Session, aot_host_target,
if __name__ == "__main__":
- sys.exit(pytest.main(sys.argv))
+ tvm.testing.main()
diff --git a/tests/python/contrib/test_hexagon/test_maxpool2d_blocked.py b/tests/python/contrib/test_hexagon/test_maxpool2d_blocked.py
index 5fca54f47c..23f7d6ed27 100644
--- a/tests/python/contrib/test_hexagon/test_maxpool2d_blocked.py
+++ b/tests/python/contrib/test_hexagon/test_maxpool2d_blocked.py
@@ -18,6 +18,7 @@
import sys
import tvm
+import tvm.testing
from tvm import te
from tvm import topi
from tvm.topi import testing
@@ -150,4 +151,4 @@ class TestMaxPooling(BaseMaxPooling):
if __name__ == "__main__":
- sys.exit(pytest.main(sys.argv))
+ tvm.testing.main()
diff --git a/tests/python/contrib/test_hexagon/test_models.py b/tests/python/contrib/test_hexagon/test_models.py
index 74f52f20d9..4fdc951574 100644
--- a/tests/python/contrib/test_hexagon/test_models.py
+++ b/tests/python/contrib/test_hexagon/test_models.py
@@ -135,4 +135,4 @@ def test_mobilenet_aot(hexagon_session: Session, aot_host_target, aot_target, en
if __name__ == "__main__":
- sys.exit(pytest.main(sys.argv))
+ tvm.testing.main()
diff --git a/tests/python/contrib/test_hexagon/test_usmp.py b/tests/python/contrib/test_hexagon/test_usmp.py
index 03badfb655..9ae0feeaff 100644
--- a/tests/python/contrib/test_hexagon/test_usmp.py
+++ b/tests/python/contrib/test_hexagon/test_usmp.py
@@ -109,4 +109,4 @@ def test_conv2d(hexagon_session: Session, aot_host_target, aot_target, usmp_enab
if __name__ == "__main__":
- sys.exit(pytest.main(sys.argv))
+ tvm.testing.main()
diff --git a/tests/python/contrib/test_hexagon/topi/test_batch_matmul.py b/tests/python/contrib/test_hexagon/topi/test_batch_matmul.py
index 093ce37e5e..467ebd06b9 100644
--- a/tests/python/contrib/test_hexagon/topi/test_batch_matmul.py
+++ b/tests/python/contrib/test_hexagon/topi/test_batch_matmul.py
@@ -20,6 +20,7 @@ import pytest
import sys
import tvm
+import tvm.testing
from tvm import topi
from tvm import te
from tvm.contrib.hexagon.session import Session
@@ -139,4 +140,4 @@ class TestMatMulInt8:
if __name__ == "__main__":
- sys.exit(pytest.main(sys.argv))
+ tvm.testing.main()
diff --git a/tests/python/contrib/test_hexagon/topi/test_conv2d_nchw.py b/tests/python/contrib/test_hexagon/topi/test_conv2d_nchw.py
index 7f530a5c4d..c755a4d018 100644
--- a/tests/python/contrib/test_hexagon/topi/test_conv2d_nchw.py
+++ b/tests/python/contrib/test_hexagon/topi/test_conv2d_nchw.py
@@ -20,6 +20,7 @@ import pytest
import sys
import tvm
+import tvm.testing
from tvm import topi
from tvm import te
from tvm.contrib.hexagon.session import Session
@@ -242,4 +243,4 @@ class TestAsymmetricPadding(BaseConv2DTests):
if __name__ == "__main__":
- sys.exit(pytest.main(sys.argv))
+ tvm.testing.main()
diff --git a/tests/python/contrib/test_hexagon/topi/test_conv2d_nhwc.py b/tests/python/contrib/test_hexagon/topi/test_conv2d_nhwc.py
index 74a3f8dafa..96062aa1b4 100644
--- a/tests/python/contrib/test_hexagon/topi/test_conv2d_nhwc.py
+++ b/tests/python/contrib/test_hexagon/topi/test_conv2d_nhwc.py
@@ -20,6 +20,7 @@ import pytest
import sys
import tvm
+import tvm.testing
from tvm import topi
from tvm import te
from tvm.contrib.hexagon.session import Session
@@ -121,4 +122,4 @@ class TestConv2dNHWC(BaseConv2DTests):
if __name__ == "__main__":
- sys.exit(pytest.main(sys.argv))
+ tvm.testing.main()
diff --git a/tests/python/contrib/test_hexagon/topi/test_dense.py b/tests/python/contrib/test_hexagon/topi/test_dense.py
index 189b05fcaa..967278251c 100644
--- a/tests/python/contrib/test_hexagon/topi/test_dense.py
+++ b/tests/python/contrib/test_hexagon/topi/test_dense.py
@@ -20,6 +20,7 @@ import pytest
import sys
import tvm
+import tvm.testing
from tvm import topi
from tvm import te
from tvm.contrib.hexagon.session import Session
@@ -115,4 +116,4 @@ def test_dense(
if __name__ == "__main__":
- sys.exit(pytest.main(sys.argv))
+ tvm.testing.main()
diff --git a/tests/python/contrib/test_hexagon/topi/test_pooling.py b/tests/python/contrib/test_hexagon/topi/test_pooling.py
index 9ce54bf9a6..ededdad267 100644
--- a/tests/python/contrib/test_hexagon/topi/test_pooling.py
+++ b/tests/python/contrib/test_hexagon/topi/test_pooling.py
@@ -20,6 +20,7 @@ import pytest
import sys
import tvm
+import tvm.testing
from tvm import topi
from tvm import te
from tvm.contrib.hexagon.session import Session
@@ -736,4 +737,4 @@ class TestPool3D:
if __name__ == "__main__":
- sys.exit(pytest.main(sys.argv))
+ tvm.testing.main()
diff --git a/tests/python/contrib/test_hexagon/topi/test_reduce.py b/tests/python/contrib/test_hexagon/topi/test_reduce.py
index 203a2bd31d..c806964545 100644
--- a/tests/python/contrib/test_hexagon/topi/test_reduce.py
+++ b/tests/python/contrib/test_hexagon/topi/test_reduce.py
@@ -20,6 +20,7 @@ import pytest
import sys
import tvm
+import tvm.testing
from tvm import topi
from tvm import te
from tvm.contrib.hexagon.session import Session
@@ -163,4 +164,4 @@ def test_reduce_map(
if __name__ == "__main__":
- sys.exit(pytest.main(sys.argv))
+ tvm.testing.main()
diff --git a/tests/python/contrib/test_hexagon/topi/test_softmax.py b/tests/python/contrib/test_hexagon/topi/test_softmax.py
index 7e734af7e0..7a2435e8dc 100644
--- a/tests/python/contrib/test_hexagon/topi/test_softmax.py
+++ b/tests/python/contrib/test_hexagon/topi/test_softmax.py
@@ -20,6 +20,7 @@ import pytest
import sys
import tvm
+import tvm.testing
from tvm import topi
from tvm import te
from tvm.contrib.hexagon.session import Session
@@ -97,4 +98,4 @@ def test_softmax(hexagon_session: Session, shape, dtype, softmax_operation):
if __name__ == "__main__":
- sys.exit(pytest.main(sys.argv))
+ tvm.testing.main()
diff --git a/tests/python/contrib/test_rpc_server_device.py b/tests/python/contrib/test_rpc_server_device.py
index 7999a05be2..db5459edf2 100644
--- a/tests/python/contrib/test_rpc_server_device.py
+++ b/tests/python/contrib/test_rpc_server_device.py
@@ -440,4 +440,4 @@ def test_check_auto_schedule_tuning(host, port): # pylint: disable=too-many-loc
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/contrib/test_tensorrt.py b/tests/python/contrib/test_tensorrt.py
index 4e6aab14c0..982ec976d5 100644
--- a/tests/python/contrib/test_tensorrt.py
+++ b/tests/python/contrib/test_tensorrt.py
@@ -1402,6 +1402,4 @@ def test_empty_subgraph(run_module):
if __name__ == "__main__":
- import sys
-
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/contrib/test_verilator/test_verilator_ops.py b/tests/python/contrib/test_verilator/test_verilator_ops.py
index 26d37ef104..29d54890b3 100644
--- a/tests/python/contrib/test_verilator/test_verilator_ops.py
+++ b/tests/python/contrib/test_verilator/test_verilator_ops.py
@@ -19,6 +19,7 @@
import numpy as np
import tvm
+import tvm.testing
from tvm import relay
import pytest
@@ -195,6 +196,4 @@ def test_bias_add():
if __name__ == "__main__":
- import sys
-
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/driver/tvmc/test_compiler.py b/tests/python/driver/tvmc/test_compiler.py
index bfbf9922e0..d6ae27957d 100644
--- a/tests/python/driver/tvmc/test_compiler.py
+++ b/tests/python/driver/tvmc/test_compiler.py
@@ -681,6 +681,4 @@ def test_compile_tflite_module_with_mod_name_and_ethosu(
if __name__ == "__main__":
- import sys
-
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/driver/tvmc/test_mlf.py b/tests/python/driver/tvmc/test_mlf.py
index 045562ad5b..f930f39bca 100644
--- a/tests/python/driver/tvmc/test_mlf.py
+++ b/tests/python/driver/tvmc/test_mlf.py
@@ -21,6 +21,7 @@ import shlex
import sys
import tvm
+import tvm.testing
from tvm.autotvm.measure.executor import Executor
from tvm.driver import tvmc
from tvm.driver.tvmc.main import _main
@@ -164,4 +165,4 @@ def test_tvmc_import_package_mlf_aot(tflite_mobilenet_v1_1_quant, tflite_compile
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/driver/tvmc/test_target.py b/tests/python/driver/tvmc/test_target.py
index b842618efc..4438ec437c 100644
--- a/tests/python/driver/tvmc/test_target.py
+++ b/tests/python/driver/tvmc/test_target.py
@@ -16,6 +16,7 @@
# under the License.
import pytest
+import tvm.testing
from tvm.driver.tvmc import TVMCException
from tvm.driver.tvmc.target import target_from_cli, tokenize_target, parse_target
@@ -163,6 +164,4 @@ def test_parse_multiple_target_with_opts_ethos_n78():
if __name__ == "__main__":
- import sys
-
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/integration/test_arm_mprofile_dsp.py b/tests/python/integration/test_arm_mprofile_dsp.py
index 7628755af4..2bcf284f3d 100644
--- a/tests/python/integration/test_arm_mprofile_dsp.py
+++ b/tests/python/integration/test_arm_mprofile_dsp.py
@@ -349,4 +349,4 @@ def test_avgpool_1d(data_shape_ncw, pool_size, strides, padding):
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/integration/test_tuning.py b/tests/python/integration/test_tuning.py
index 5ca0e1ae67..03f38aa9cc 100644
--- a/tests/python/integration/test_tuning.py
+++ b/tests/python/integration/test_tuning.py
@@ -219,4 +219,4 @@ def test_tuning_cpu():
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/relay/aot/test_c_device_api.py b/tests/python/relay/aot/test_c_device_api.py
index 3c7db62890..b972b0845c 100644
--- a/tests/python/relay/aot/test_c_device_api.py
+++ b/tests/python/relay/aot/test_c_device_api.py
@@ -21,6 +21,7 @@ from collections import OrderedDict
import numpy as np
import pytest
import re
+import tvm.testing
from tvm import relay
from tvm.ir.module import IRModule
@@ -245,4 +246,4 @@ def test_without_device_api_packed_api(non_device_api_main_func):
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/relay/aot/test_cpp_aot.py b/tests/python/relay/aot/test_cpp_aot.py
index 4a12678a79..04a1111e35 100644
--- a/tests/python/relay/aot/test_cpp_aot.py
+++ b/tests/python/relay/aot/test_cpp_aot.py
@@ -202,4 +202,4 @@ def test_pass_wrong_device_arg():
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/relay/aot/test_crt_aot.py b/tests/python/relay/aot/test_crt_aot.py
index ffae70d0cf..f4ef8d7845 100644
--- a/tests/python/relay/aot/test_crt_aot.py
+++ b/tests/python/relay/aot/test_crt_aot.py
@@ -1073,4 +1073,4 @@ def test_aot_uses_anf():
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/relay/aot/test_crt_aot_usmp.py b/tests/python/relay/aot/test_crt_aot_usmp.py
index 60b46d96b5..3ede229887 100644
--- a/tests/python/relay/aot/test_crt_aot_usmp.py
+++ b/tests/python/relay/aot/test_crt_aot_usmp.py
@@ -630,7 +630,4 @@ def test_u4_usecase_incompatible_interface_api_errors():
if __name__ == "__main__":
- import sys
- import pytest
-
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/relay/dyn/test_dynamic_op_level10.py b/tests/python/relay/dyn/test_dynamic_op_level10.py
index 5a31977b45..db17fc3efe 100644
--- a/tests/python/relay/dyn/test_dynamic_op_level10.py
+++ b/tests/python/relay/dyn/test_dynamic_op_level10.py
@@ -151,7 +151,4 @@ def test_dyn_one_hot(executor_kind):
if __name__ == "__main__":
- import sys
- import pytest
-
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/relay/dyn/test_dynamic_op_level3.py b/tests/python/relay/dyn/test_dynamic_op_level3.py
index 0e68cd7246..ab562f0f49 100644
--- a/tests/python/relay/dyn/test_dynamic_op_level3.py
+++ b/tests/python/relay/dyn/test_dynamic_op_level3.py
@@ -478,6 +478,4 @@ def test_dyn_cast():
if __name__ == "__main__":
- import sys
-
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/relay/op/annotation/test_annotation.py b/tests/python/relay/op/annotation/test_annotation.py
index dcbb40cdca..502d88ff55 100644
--- a/tests/python/relay/op/annotation/test_annotation.py
+++ b/tests/python/relay/op/annotation/test_annotation.py
@@ -16,6 +16,7 @@
# under the License.
"""Unit tests for annotations."""
import tvm
+import tvm.testing
from tvm import relay
import pytest
@@ -62,6 +63,4 @@ def test_on_device_free():
if __name__ == "__main__":
- import sys
-
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/relay/op/test_tensor.py b/tests/python/relay/op/test_tensor.py
index 2d561cf79e..ceee27161c 100644
--- a/tests/python/relay/op/test_tensor.py
+++ b/tests/python/relay/op/test_tensor.py
@@ -16,6 +16,7 @@
# under the License.
"""Unit tests for tensor helpers."""
import tvm
+import tvm.testing
from tvm import relay
import pytest
@@ -47,6 +48,4 @@ def test_device_copy_via_device():
if __name__ == "__main__":
- import sys
-
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/relay/strategy/arm_cpu/test_conv2d_nchw.py b/tests/python/relay/strategy/arm_cpu/test_conv2d_nchw.py
index e88210a59e..6f1ea0b34a 100644
--- a/tests/python/relay/strategy/arm_cpu/test_conv2d_nchw.py
+++ b/tests/python/relay/strategy/arm_cpu/test_conv2d_nchw.py
@@ -107,4 +107,4 @@ class TestConv2d_OIHW_small_kernel(BasicConv2dTests):
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/relay/strategy/arm_cpu/test_conv2d_nhwc.py b/tests/python/relay/strategy/arm_cpu/test_conv2d_nhwc.py
index f56645d436..f5ae6f51db 100644
--- a/tests/python/relay/strategy/arm_cpu/test_conv2d_nhwc.py
+++ b/tests/python/relay/strategy/arm_cpu/test_conv2d_nhwc.py
@@ -151,4 +151,4 @@ class TestConv2d_HWIO(BasicConv2dTests):
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/relay/strategy/arm_cpu/test_depthwise_conv2d.py b/tests/python/relay/strategy/arm_cpu/test_depthwise_conv2d.py
index 89f1fb1843..96628a6371 100644
--- a/tests/python/relay/strategy/arm_cpu/test_depthwise_conv2d.py
+++ b/tests/python/relay/strategy/arm_cpu/test_depthwise_conv2d.py
@@ -150,4 +150,4 @@ class TestDepthwiseConv2d_NHWC_HWOI(BasicDepthwiseConv2dTests):
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/relay/strategy/arm_cpu/test_group_conv2d.py b/tests/python/relay/strategy/arm_cpu/test_group_conv2d.py
index d3f504d04e..b24c651de9 100644
--- a/tests/python/relay/strategy/arm_cpu/test_group_conv2d.py
+++ b/tests/python/relay/strategy/arm_cpu/test_group_conv2d.py
@@ -148,4 +148,4 @@ class TestGroupConv2d_NHWC_HWIO(BasicGroupConv2dTests):
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/relay/test_any.py b/tests/python/relay/test_any.py
index 8ef2a0062d..f602a17e24 100644
--- a/tests/python/relay/test_any.py
+++ b/tests/python/relay/test_any.py
@@ -18,6 +18,7 @@ import os
import numpy as np
import tvm
+import tvm.testing
import tvm.topi.testing
from tvm import relay, te
from tvm.relay.loops import while_loop
@@ -2149,7 +2150,4 @@ def test_searchsorted():
if __name__ == "__main__":
- import sys
- import pytest
-
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/relay/test_auto_scheduler_layout_rewrite_networks.py b/tests/python/relay/test_auto_scheduler_layout_rewrite_networks.py
index f9030c525b..54099e45a7 100644
--- a/tests/python/relay/test_auto_scheduler_layout_rewrite_networks.py
+++ b/tests/python/relay/test_auto_scheduler_layout_rewrite_networks.py
@@ -214,4 +214,4 @@ def test_batch_matmul(target, dev):
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/relay/test_build_module.py b/tests/python/relay/test_build_module.py
index b88115059e..757e5c1d8a 100644
--- a/tests/python/relay/test_build_module.py
+++ b/tests/python/relay/test_build_module.py
@@ -18,6 +18,7 @@
import pytest
import tvm
+import tvm.testing
from tvm import relay
from tvm.target.target import Target
from tvm.relay.backend import Runtime, Executor, graph_executor_codegen
@@ -82,6 +83,4 @@ def test_build_relay_graph_():
if __name__ == "__main__":
- import sys
-
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/relay/test_external_codegen.py b/tests/python/relay/test_external_codegen.py
index 41c113684f..c5a9041b15 100644
--- a/tests/python/relay/test_external_codegen.py
+++ b/tests/python/relay/test_external_codegen.py
@@ -22,6 +22,7 @@ import numpy as np
import pytest
import tvm
+import tvm.testing
from tvm import relay, runtime
from tvm.relay.build_module import bind_params_by_name
from tvm.relay.op.annotation import compiler_begin, compiler_end
@@ -351,4 +352,4 @@ def test_load_params_with_constants_in_ext_codegen():
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/relay/test_ir_parser.py b/tests/python/relay/test_ir_parser.py
index 7a283461e0..3f0b74468b 100644
--- a/tests/python/relay/test_ir_parser.py
+++ b/tests/python/relay/test_ir_parser.py
@@ -18,6 +18,7 @@ import numpy as np
import pytest
import tvm
+import tvm.testing
from tvm import relay
import tvm.relay.testing
from numpy import isclose
@@ -1028,6 +1029,4 @@ def test_init_module_and_metatable():
if __name__ == "__main__":
- import sys
-
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/relay/test_ir_structural_equal_hash.py b/tests/python/relay/test_ir_structural_equal_hash.py
index dffc418934..a808259d26 100644
--- a/tests/python/relay/test_ir_structural_equal_hash.py
+++ b/tests/python/relay/test_ir_structural_equal_hash.py
@@ -16,6 +16,7 @@
# under the License.
import numpy as np
import tvm
+import tvm.testing
from tvm import relay
from tvm.relay.testing import run_opt_pass
@@ -796,7 +797,4 @@ def test_lets():
if __name__ == "__main__":
- import sys
- import pytest
-
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/relay/test_ir_text_printer.py b/tests/python/relay/test_ir_text_printer.py
index 60f6119986..ba3b2b348a 100644
--- a/tests/python/relay/test_ir_text_printer.py
+++ b/tests/python/relay/test_ir_text_printer.py
@@ -15,6 +15,7 @@
# specific language governing permissions and limitations
# under the License.
import tvm
+import tvm.testing
from tvm import te
from tvm import relay
from tvm.relay import testing
@@ -307,7 +308,4 @@ def test_slash_in_identifier():
if __name__ == "__main__":
- import sys
- import pytest
-
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/relay/test_op_grad_level1.py b/tests/python/relay/test_op_grad_level1.py
index cb94f297cf..d8e3743930 100644
--- a/tests/python/relay/test_op_grad_level1.py
+++ b/tests/python/relay/test_op_grad_level1.py
@@ -215,4 +215,4 @@ def test_concatenate_grad(executor_kind, target, dev):
if __name__ == "__main__":
- sys.exit(pytest.main(sys.argv))
+ tvm.testing.main()
diff --git a/tests/python/relay/test_op_grad_level10.py b/tests/python/relay/test_op_grad_level10.py
index 6b2531a4a1..08add13f80 100644
--- a/tests/python/relay/test_op_grad_level10.py
+++ b/tests/python/relay/test_op_grad_level10.py
@@ -150,4 +150,4 @@ def test_one_hot_grad(executor_kind, target, dev, index_dtype, val_dtype):
if __name__ == "__main__":
- sys.exit(pytest.main(sys.argv))
+ tvm.testing.main()
diff --git a/tests/python/relay/test_op_level10.py b/tests/python/relay/test_op_level10.py
index 7e0b8ad89f..a2d7f99389 100644
--- a/tests/python/relay/test_op_level10.py
+++ b/tests/python/relay/test_op_level10.py
@@ -743,4 +743,4 @@ def test_nll_loss(executor_kind, dev, target):
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/relay/test_op_level2.py b/tests/python/relay/test_op_level2.py
index 726ee578da..b4f30c2eab 100644
--- a/tests/python/relay/test_op_level2.py
+++ b/tests/python/relay/test_op_level2.py
@@ -1997,4 +1997,4 @@ def test_conv2d_rocm_sdot4():
if __name__ == "__main__":
- sys.exit(pytest.main(sys.argv))
+ tvm.testing.main()
diff --git a/tests/python/relay/test_op_level3.py b/tests/python/relay/test_op_level3.py
index 9d27839c47..f91a027de4 100644
--- a/tests/python/relay/test_op_level3.py
+++ b/tests/python/relay/test_op_level3.py
@@ -2208,4 +2208,4 @@ class TestSTFT:
if __name__ == "__main__":
- sys.exit(pytest.main(sys.argv))
+ tvm.testing.main()
diff --git a/tests/python/relay/test_op_level4.py b/tests/python/relay/test_op_level4.py
index e46832d570..89de2f6a95 100644
--- a/tests/python/relay/test_op_level4.py
+++ b/tests/python/relay/test_op_level4.py
@@ -657,4 +657,4 @@ def test_strided_set():
if __name__ == "__main__":
- sys.exit(pytest.main(sys.argv))
+ tvm.testing.main()
diff --git a/tests/python/relay/test_op_level5.py b/tests/python/relay/test_op_level5.py
index af9c08409c..8b5f849c3d 100644
--- a/tests/python/relay/test_op_level5.py
+++ b/tests/python/relay/test_op_level5.py
@@ -1580,4 +1580,4 @@ def test_all_class_non_max_suppression(executor_kind):
if __name__ == "__main__":
- sys.exit(pytest.main(sys.argv))
+ tvm.testing.main()
diff --git a/tests/python/relay/test_op_qnn_unary_elementwise.py b/tests/python/relay/test_op_qnn_unary_elementwise.py
index 18acc119a9..f697357871 100644
--- a/tests/python/relay/test_op_qnn_unary_elementwise.py
+++ b/tests/python/relay/test_op_qnn_unary_elementwise.py
@@ -21,6 +21,7 @@ import numpy as np
import pytest
import scipy.special
import tvm
+import tvm.testing
from tvm import relay
@@ -209,6 +210,4 @@ class TestSigmoid:
if __name__ == "__main__":
- import sys
-
- sys.exit(pytest.main([__file__]))
+ tvm.testing.main()
diff --git a/tests/python/relay/test_pass_annotate_spans_defuse.py b/tests/python/relay/test_pass_annotate_spans_defuse.py
index d6b16e70a5..c513c592d6 100644
--- a/tests/python/relay/test_pass_annotate_spans_defuse.py
+++ b/tests/python/relay/test_pass_annotate_spans_defuse.py
@@ -52,7 +52,4 @@ def test_annotate_spans_compatibility():
if __name__ == "__main__":
- import sys
- import pytest
-
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/relay/test_pass_dead_code_elimination.py b/tests/python/relay/test_pass_dead_code_elimination.py
index ff7919eb77..8844de7567 100644
--- a/tests/python/relay/test_pass_dead_code_elimination.py
+++ b/tests/python/relay/test_pass_dead_code_elimination.py
@@ -15,6 +15,7 @@
# specific language governing permissions and limitations
# under the License.
import tvm
+import tvm.testing
from tvm.relay import Function, transform
from tvm.relay.testing import inception_v3
import pytest
@@ -347,6 +348,4 @@ def test_complexity():
if __name__ == "__main__":
- import sys
-
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/relay/test_pass_fake_quantization_to_integer.py b/tests/python/relay/test_pass_fake_quantization_to_integer.py
index 5cfaa49665..d0c8cca6b7 100644
--- a/tests/python/relay/test_pass_fake_quantization_to_integer.py
+++ b/tests/python/relay/test_pass_fake_quantization_to_integer.py
@@ -18,6 +18,7 @@
import numpy as np
import pytest
import tvm
+import tvm.testing
from tvm import relay
from tvm.relay.transform import fake_quantization_to_integer
@@ -1017,6 +1018,4 @@ def test_fq_qat_intermediate_infertype():
if __name__ == "__main__":
- import sys
-
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/relay/test_pass_flatten_atrous_conv.py b/tests/python/relay/test_pass_flatten_atrous_conv.py
index a3d3eb94ae..39c92c5ed6 100644
--- a/tests/python/relay/test_pass_flatten_atrous_conv.py
+++ b/tests/python/relay/test_pass_flatten_atrous_conv.py
@@ -18,6 +18,7 @@
import numpy as np
import pytest
import tvm
+import tvm.testing
from tvm import relay
from tvm.contrib import graph_executor
@@ -467,6 +468,4 @@ def test_fac_relay_build():
if __name__ == "__main__":
- import sys
-
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/relay/test_pass_fold_constant.py b/tests/python/relay/test_pass_fold_constant.py
index e7235d6fcf..f69447d43e 100644
--- a/tests/python/relay/test_pass_fold_constant.py
+++ b/tests/python/relay/test_pass_fold_constant.py
@@ -16,6 +16,7 @@
# under the License.
import numpy as np
import tvm
+import tvm.testing
from tvm import relay
from tvm.relay.backend import Executor
from tvm.relay import transform
@@ -572,7 +573,4 @@ def test_pass_link_params():
if __name__ == "__main__":
- import sys
- import pytest
-
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/relay/test_pass_lazy_gradient_init.py b/tests/python/relay/test_pass_lazy_gradient_init.py
index bc18f0a212..323eb6aa50 100644
--- a/tests/python/relay/test_pass_lazy_gradient_init.py
+++ b/tests/python/relay/test_pass_lazy_gradient_init.py
@@ -445,7 +445,4 @@ def test_ones_like():
if __name__ == "__main__":
- import sys
- import pytest
-
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/relay/test_pass_manifest_lifetimes.py b/tests/python/relay/test_pass_manifest_lifetimes.py
index a9b038216b..f5b4cab207 100644
--- a/tests/python/relay/test_pass_manifest_lifetimes.py
+++ b/tests/python/relay/test_pass_manifest_lifetimes.py
@@ -15,6 +15,7 @@
# specific language governing permissions and limitations
# under the License.
import tvm
+import tvm.testing
from tvm.relay import Function, transform
from tvm.relay.testing import inception_v3
import pytest
@@ -144,4 +145,4 @@ def test_simple_match():
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/relay/test_pass_partial_eval.py b/tests/python/relay/test_pass_partial_eval.py
index 84ecc8477e..bec9041e46 100644
--- a/tests/python/relay/test_pass_partial_eval.py
+++ b/tests/python/relay/test_pass_partial_eval.py
@@ -17,6 +17,7 @@
import numpy as np
import tvm
+import tvm.testing
from tvm import relay
from tvm.relay.prelude import Prelude
from tvm.relay import op, create_executor, transform
@@ -350,7 +351,4 @@ def test_tuple_match():
if __name__ == "__main__":
- import sys
- import pytest
-
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/relay/test_pass_plan_devices.py b/tests/python/relay/test_pass_plan_devices.py
index e485b626b4..1158be0037 100644
--- a/tests/python/relay/test_pass_plan_devices.py
+++ b/tests/python/relay/test_pass_plan_devices.py
@@ -1703,7 +1703,4 @@ def test_stack_overflow():
if __name__ == "__main__":
- import sys
- import pytest
-
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/relay/test_pass_to_a_normal_form.py b/tests/python/relay/test_pass_to_a_normal_form.py
index f44f2a9925..70971d243c 100644
--- a/tests/python/relay/test_pass_to_a_normal_form.py
+++ b/tests/python/relay/test_pass_to_a_normal_form.py
@@ -18,6 +18,7 @@ import pytest
import sys
import numpy as np
import tvm
+import tvm.testing
from tvm import te
from tvm import relay
from tvm.relay.analysis import detect_feature
@@ -228,4 +229,4 @@ def test_gradient_if():
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/relay/test_pass_to_cps.py b/tests/python/relay/test_pass_to_cps.py
index 2200320c44..d0a29aff77 100644
--- a/tests/python/relay/test_pass_to_cps.py
+++ b/tests/python/relay/test_pass_to_cps.py
@@ -16,6 +16,7 @@
# under the License.
import numpy as np
import tvm
+import tvm.testing
from tvm import relay
from tvm.relay.analysis import detect_feature
from tvm.relay.transform import to_cps, un_cps
@@ -123,7 +124,4 @@ def test_cps_pe():
if __name__ == "__main__":
- import sys
- import pytest
-
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/relay/test_prng.py b/tests/python/relay/test_prng.py
index 29e271b1c4..7e62ee8a75 100644
--- a/tests/python/relay/test_prng.py
+++ b/tests/python/relay/test_prng.py
@@ -166,6 +166,4 @@ def test_threefry_generate_out_size():
if __name__ == "__main__":
- import sys
-
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/relay/test_relay_te_compiler.py b/tests/python/relay/test_relay_te_compiler.py
index e200e79c15..16041f00cc 100644
--- a/tests/python/relay/test_relay_te_compiler.py
+++ b/tests/python/relay/test_relay_te_compiler.py
@@ -24,7 +24,6 @@ from tvm import topi
from tvm.relay.backend import te_compiler
from tvm.relay.testing import run_infer_type
from tvm.relay.testing.temp_op_attr import TempOpAttr
-import tvm.testing
@autotvm.register_topi_compute("test/conv2d_1")
diff --git a/tests/python/relay/test_target_hooks.py b/tests/python/relay/test_target_hooks.py
index 5856dc1e1c..22b3b8cb30 100644
--- a/tests/python/relay/test_target_hooks.py
+++ b/tests/python/relay/test_target_hooks.py
@@ -19,6 +19,7 @@ import sys
import numpy as np
import pytest
+import tvm.testing
from tvm import relay, IRModule
from utils.external_codegen import (
@@ -73,4 +74,4 @@ def test_runtime_module_generation(check_result):
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/relay/test_vm.py b/tests/python/relay/test_vm.py
index e05e84d2ec..4f649ad9be 100644
--- a/tests/python/relay/test_vm.py
+++ b/tests/python/relay/test_vm.py
@@ -1406,6 +1406,4 @@ def test_vm_save_and_load_without_designating_late_bound_consts():
if __name__ == "__main__":
- import sys
-
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/target/test_virtual_device.py b/tests/python/target/test_virtual_device.py
index 392e418556..a6434480fa 100644
--- a/tests/python/target/test_virtual_device.py
+++ b/tests/python/target/test_virtual_device.py
@@ -16,6 +16,7 @@
# under the License.
import pytest
import tvm
+import tvm.testing
def test_make_virtual_device_for_device():
@@ -45,7 +46,4 @@ def test_make_virtual_device_for_device_target_and_memory_scope():
if __name__ == "__main__":
- import sys
- import pytest
-
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/tir/analysis/test_device_constraint_utils.py b/tests/python/tir/analysis/test_device_constraint_utils.py
index 65cb4e3982..9dcf472300 100644
--- a/tests/python/tir/analysis/test_device_constraint_utils.py
+++ b/tests/python/tir/analysis/test_device_constraint_utils.py
@@ -16,6 +16,7 @@
# under the License.
"""Test retrieving and applying memory scope constraints to PrimFuncs"""
import tvm
+import tvm.testing
from tvm import tir
from tvm import relay
from tvm.script import tir as T
@@ -64,7 +65,4 @@ def test_apply_prim_func_arg_and_result_memory_constraints():
if __name__ == "__main__":
- import sys
- import pytest
-
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/topi/python/test_topi_conv1d_transpose_ncw.py b/tests/python/topi/python/test_topi_conv1d_transpose_ncw.py
index 93cfecf423..aa14f739a8 100644
--- a/tests/python/topi/python/test_topi_conv1d_transpose_ncw.py
+++ b/tests/python/topi/python/test_topi_conv1d_transpose_ncw.py
@@ -118,4 +118,4 @@ def test_conv1d_transpose_ncw(
if __name__ == "__main__":
- sys.exit(pytest.main(sys.argv))
+ tvm.testing.main()
diff --git a/tests/python/topi/python/test_topi_conv2d_int8.py b/tests/python/topi/python/test_topi_conv2d_int8.py
index 17c5573b2c..6070cafa9c 100644
--- a/tests/python/topi/python/test_topi_conv2d_int8.py
+++ b/tests/python/topi/python/test_topi_conv2d_int8.py
@@ -674,4 +674,4 @@ def test_conv2d_nhwc():
if __name__ == "__main__":
- sys.exit(pytest.main(sys.argv))
+ tvm.testing.main()
diff --git a/tests/python/topi/python/test_topi_conv2d_nchw.py b/tests/python/topi/python/test_topi_conv2d_nchw.py
index 96a7ff9b92..e0c0b830b5 100644
--- a/tests/python/topi/python/test_topi_conv2d_nchw.py
+++ b/tests/python/topi/python/test_topi_conv2d_nchw.py
@@ -351,4 +351,4 @@ class TestBiasRelu(BaseConv2DTests):
if __name__ == "__main__":
- sys.exit(pytest.main(sys.argv))
+ tvm.testing.main()
diff --git a/tests/python/topi/python/test_topi_conv2d_nhwc.py b/tests/python/topi/python/test_topi_conv2d_nhwc.py
index 8c125af721..362de3a769 100644
--- a/tests/python/topi/python/test_topi_conv2d_nhwc.py
+++ b/tests/python/topi/python/test_topi_conv2d_nhwc.py
@@ -96,4 +96,4 @@ def test_conv2d_nhwc(target, dev, ref_data, dtype, stride, padding, dilation):
if __name__ == "__main__":
- sys.exit(pytest.main(sys.argv))
+ tvm.testing.main()
diff --git a/tests/python/topi/python/test_topi_correlation.py b/tests/python/topi/python/test_topi_correlation.py
index 3dff54dfa6..6592e9bdad 100644
--- a/tests/python/topi/python/test_topi_correlation.py
+++ b/tests/python/topi/python/test_topi_correlation.py
@@ -21,6 +21,7 @@ import numpy as np
import pytest
import tvm
+import tvm.testing
import tvm.topi.testing
from tvm import autotvm, te, topi
@@ -93,4 +94,4 @@ def test_correlation_nchw(
if __name__ == "__main__":
- sys.exit(pytest.main(sys.argv))
+ tvm.testing.main()
diff --git a/tests/python/topi/python/test_topi_dense.py b/tests/python/topi/python/test_topi_dense.py
index 2826d70ba0..7e65e2449f 100644
--- a/tests/python/topi/python/test_topi_dense.py
+++ b/tests/python/topi/python/test_topi_dense.py
@@ -181,4 +181,4 @@ def test_dense_cuda_int8(
if __name__ == "__main__":
- sys.exit(pytest.main(sys.argv))
+ tvm.testing.main()
diff --git a/tests/python/topi/python/test_topi_depthwise_conv2d.py b/tests/python/topi/python/test_topi_depthwise_conv2d.py
index 24c232129c..a4bfbbfe8e 100644
--- a/tests/python/topi/python/test_topi_depthwise_conv2d.py
+++ b/tests/python/topi/python/test_topi_depthwise_conv2d.py
@@ -438,4 +438,4 @@ class TestDepthwiseConv2DArmCompile(BaseDepthwiseConv2D):
if __name__ == "__main__":
- sys.exit(pytest.main(sys.argv))
+ tvm.testing.main()
diff --git a/tests/python/topi/python/test_topi_loss.py b/tests/python/topi/python/test_topi_loss.py
index c1b61e5b49..53960139dd 100644
--- a/tests/python/topi/python/test_topi_loss.py
+++ b/tests/python/topi/python/test_topi_loss.py
@@ -65,4 +65,4 @@ def test_nll_loss(target, dev, prediction_shape, reduction, ignore_index, dtype)
if __name__ == "__main__":
- sys.exit(pytest.main(sys.argv))
+ tvm.testing.main()
diff --git a/tests/python/topi/python/test_topi_math.py b/tests/python/topi/python/test_topi_math.py
index 5ee049fa37..e855250513 100644
--- a/tests/python/topi/python/test_topi_math.py
+++ b/tests/python/topi/python/test_topi_math.py
@@ -237,4 +237,4 @@ def test_cast(target, dev, cast_ref_data, from_dtype, to_dtype):
if __name__ == "__main__":
- sys.exit(pytest.main(sys.argv))
+ tvm.testing.main()
diff --git a/tests/python/topi/python/test_topi_reduce.py b/tests/python/topi/python/test_topi_reduce.py
index 23d762c500..e7f47ba0c4 100644
--- a/tests/python/topi/python/test_topi_reduce.py
+++ b/tests/python/topi/python/test_topi_reduce.py
@@ -184,4 +184,4 @@ def test_complex_reduce(target, dev):
if __name__ == "__main__":
- sys.exit(pytest.main(sys.argv))
+ tvm.testing.main()
diff --git a/tests/python/topi/python/test_topi_relu.py b/tests/python/topi/python/test_topi_relu.py
index d2d790e33d..9488350689 100644
--- a/tests/python/topi/python/test_topi_relu.py
+++ b/tests/python/topi/python/test_topi_relu.py
@@ -113,4 +113,4 @@ def test_prelu(x, w, axis, weight_reshape):
if __name__ == "__main__":
- sys.exit(pytest.main(sys.argv))
+ tvm.testing.main()
diff --git a/tests/python/topi/python/test_topi_softmax.py b/tests/python/topi/python/test_topi_softmax.py
index 97fbedcc28..cd73c660e8 100644
--- a/tests/python/topi/python/test_topi_softmax.py
+++ b/tests/python/topi/python/test_topi_softmax.py
@@ -105,4 +105,4 @@ def test_softmax(target, dev, shape, dtype, ref_data, softmax_operation):
if __name__ == "__main__":
- sys.exit(pytest.main(sys.argv))
+ tvm.testing.main()
diff --git a/tests/python/topi/python/test_topi_sort.py b/tests/python/topi/python/test_topi_sort.py
index 43c6ce88be..a23b4566a2 100644
--- a/tests/python/topi/python/test_topi_sort.py
+++ b/tests/python/topi/python/test_topi_sort.py
@@ -159,4 +159,4 @@ def test_topk(target, dev, topk, axis, topk_ret_type, is_ascend, dtype):
if __name__ == "__main__":
- sys.exit(pytest.main(sys.argv))
+ tvm.testing.main()
diff --git a/tests/python/topi/python/test_topi_unique.py b/tests/python/topi/python/test_topi_unique.py
index 4dd9b193ad..e2a82f64ae 100644
--- a/tests/python/topi/python/test_topi_unique.py
+++ b/tests/python/topi/python/test_topi_unique.py
@@ -111,4 +111,4 @@ def test_unique(dev, target, in_dtype, is_sorted, with_counts, arr_size, maxval)
if __name__ == "__main__":
- sys.exit(pytest.main(sys.argv))
+ tvm.testing.main()
diff --git a/tests/python/topi/python/test_topi_vision.py b/tests/python/topi/python/test_topi_vision.py
index 6ddb86f402..5cc064944b 100644
--- a/tests/python/topi/python/test_topi_vision.py
+++ b/tests/python/topi/python/test_topi_vision.py
@@ -717,4 +717,4 @@ def test_all_class_non_max_suppression(target, dev):
if __name__ == "__main__":
- sys.exit(pytest.main(sys.argv))
+ tvm.testing.main()
diff --git a/tests/python/unittest/test_auto_scheduler_measure.py b/tests/python/unittest/test_auto_scheduler_measure.py
index 04879573bd..3fd5f97dd8 100644
--- a/tests/python/unittest/test_auto_scheduler_measure.py
+++ b/tests/python/unittest/test_auto_scheduler_measure.py
@@ -424,7 +424,4 @@ def test_measure_special_inputs_map_by_name_rpc_runner():
if __name__ == "__main__":
- import sys
- import pytest
-
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/unittest/test_auto_scheduler_sketch_generation.py b/tests/python/unittest/test_auto_scheduler_sketch_generation.py
index 6d2f870ca1..a3f63a3849 100644
--- a/tests/python/unittest/test_auto_scheduler_sketch_generation.py
+++ b/tests/python/unittest/test_auto_scheduler_sketch_generation.py
@@ -451,4 +451,4 @@ def test_cuda_zero_rank_sketch():
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/unittest/test_crt.py b/tests/python/unittest/test_crt.py
index d5611906fc..84bb17bf7d 100644
--- a/tests/python/unittest/test_crt.py
+++ b/tests/python/unittest/test_crt.py
@@ -400,4 +400,4 @@ def test_autotune():
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/unittest/test_gen_requirements.py b/tests/python/unittest/test_gen_requirements.py
index 1f6388ba3c..05223c3f43 100644
--- a/tests/python/unittest/test_gen_requirements.py
+++ b/tests/python/unittest/test_gen_requirements.py
@@ -24,6 +24,7 @@ import os
import sys
import tvm
+import tvm.testing
import pytest
@@ -217,4 +218,4 @@ def test_semver():
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/unittest/test_index_map.py b/tests/python/unittest/test_index_map.py
index a8f5204f02..bb4e429d64 100644
--- a/tests/python/unittest/test_index_map.py
+++ b/tests/python/unittest/test_index_map.py
@@ -18,6 +18,7 @@
import pytest
import tvm
+import tvm.testing
from tvm.tir import IndexMap
from tvm.ir import assert_structural_equal
@@ -186,4 +187,4 @@ def test_nonsurjective_inverse(padding_test_case):
if __name__ == "__main__":
- sys.exit(pytest.main(sys.argv))
+ tvm.testing.main()
diff --git a/tests/python/unittest/test_link_params.py b/tests/python/unittest/test_link_params.py
index ea4f4ff975..afa7457608 100644
--- a/tests/python/unittest/test_link_params.py
+++ b/tests/python/unittest/test_link_params.py
@@ -382,4 +382,4 @@ def test_crt_link_params(linkable_dtype):
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/unittest/test_meta_schedule_builder.py b/tests/python/unittest/test_meta_schedule_builder.py
index af95ea57e3..a74ac89326 100644
--- a/tests/python/unittest/test_meta_schedule_builder.py
+++ b/tests/python/unittest/test_meta_schedule_builder.py
@@ -22,6 +22,7 @@ import time
from typing import List
import pytest
+import tvm.testing
from tvm import script
from tvm._ffi import register_func
@@ -225,4 +226,4 @@ def test_meta_schedule_missing_build_func():
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/unittest/test_meta_schedule_byoc_tensorrt.py b/tests/python/unittest/test_meta_schedule_byoc_tensorrt.py
index 91e2c41b2b..21f56cc912 100644
--- a/tests/python/unittest/test_meta_schedule_byoc_tensorrt.py
+++ b/tests/python/unittest/test_meta_schedule_byoc_tensorrt.py
@@ -22,6 +22,7 @@ from typing import List
import pytest
import tvm
+import tvm.testing
from tvm import relay
from tvm.meta_schedule.arg_info import TensorInfo
from tvm.meta_schedule.builder import BuilderInput, LocalBuilder
@@ -168,4 +169,4 @@ def test_relay_model(model_name: str, input_shape: List[int], use_trt: bool):
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/unittest/test_meta_schedule_cost_model.py b/tests/python/unittest/test_meta_schedule_cost_model.py
index 621cf5f326..d1d5581813 100644
--- a/tests/python/unittest/test_meta_schedule_cost_model.py
+++ b/tests/python/unittest/test_meta_schedule_cost_model.py
@@ -25,6 +25,7 @@ from typing import List
import numpy as np
import pytest
import tvm
+import tvm.testing
from tvm.meta_schedule.cost_model import PyCostModel, RandomModel, XGBModel
from tvm.meta_schedule.feature_extractor import RandomFeatureExtractor
from tvm.meta_schedule.runner import RunnerResult
@@ -228,4 +229,4 @@ def test_meta_schedule_xgb_model_reupdate():
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/unittest/test_meta_schedule_database.py b/tests/python/unittest/test_meta_schedule_database.py
index cb7761aefe..d494f997c1 100644
--- a/tests/python/unittest/test_meta_schedule_database.py
+++ b/tests/python/unittest/test_meta_schedule_database.py
@@ -23,6 +23,7 @@ from typing import Callable
import pytest
import tvm
+import tvm.testing
from tvm import tir
from tvm.ir.module import IRModule
from tvm.meta_schedule.arg_info import ArgInfo
@@ -296,4 +297,4 @@ def test_meta_schedule_database_reload():
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/unittest/test_meta_schedule_feature_extractor_per_store_feature.py b/tests/python/unittest/test_meta_schedule_feature_extractor_per_store_feature.py
index 1ce4779246..17ea8b9d3b 100644
--- a/tests/python/unittest/test_meta_schedule_feature_extractor_per_store_feature.py
+++ b/tests/python/unittest/test_meta_schedule_feature_extractor_per_store_feature.py
@@ -20,6 +20,7 @@ from typing import Callable, List
import pytest
import tvm
+import tvm.testing
from numpy.testing import assert_allclose
from tvm import meta_schedule as ms
from tvm import te, tir
@@ -1588,4 +1589,4 @@ def test_cpu_layout_transform():
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/unittest/test_meta_schedule_integration.py b/tests/python/unittest/test_meta_schedule_integration.py
index b17d6ffc60..cd6e1b4c40 100644
--- a/tests/python/unittest/test_meta_schedule_integration.py
+++ b/tests/python/unittest/test_meta_schedule_integration.py
@@ -286,4 +286,4 @@ def test_extract_task_arm_conv2d_nchwc():
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/unittest/test_meta_schedule_post_order_apply.py b/tests/python/unittest/test_meta_schedule_post_order_apply.py
index e20da435f9..c5b6adb466 100644
--- a/tests/python/unittest/test_meta_schedule_post_order_apply.py
+++ b/tests/python/unittest/test_meta_schedule_post_order_apply.py
@@ -22,6 +22,7 @@ from typing import List
import pytest
import tvm
+import tvm.testing
from tvm._ffi import register_func
from tvm.error import TVMError
from tvm.meta_schedule import TuneContext
@@ -388,4 +389,4 @@ def test_meta_schedule_custom_search_space():
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/unittest/test_meta_schedule_postproc_verify_gpu_code.py b/tests/python/unittest/test_meta_schedule_postproc_verify_gpu_code.py
index 041f641a45..a1d2bcfcde 100644
--- a/tests/python/unittest/test_meta_schedule_postproc_verify_gpu_code.py
+++ b/tests/python/unittest/test_meta_schedule_postproc_verify_gpu_code.py
@@ -20,6 +20,7 @@ import sys
import pytest
import tvm
+import tvm.testing
from tvm import tir
from tvm.meta_schedule import TuneContext
from tvm.meta_schedule.postproc import VerifyGPUCode
@@ -452,4 +453,4 @@ def test_postproc_verify_gpu_6():
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/unittest/test_meta_schedule_runner.py b/tests/python/unittest/test_meta_schedule_runner.py
index 09e708f32f..a79498304b 100644
--- a/tests/python/unittest/test_meta_schedule_runner.py
+++ b/tests/python/unittest/test_meta_schedule_runner.py
@@ -890,4 +890,4 @@ def test_meta_schedule_local_runner_add_test():
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/unittest/test_meta_schedule_search_strategy.py b/tests/python/unittest/test_meta_schedule_search_strategy.py
index b148f58ff8..94042dd753 100644
--- a/tests/python/unittest/test_meta_schedule_search_strategy.py
+++ b/tests/python/unittest/test_meta_schedule_search_strategy.py
@@ -21,6 +21,7 @@ from typing import List
import pytest
import tvm
+import tvm.testing
from tvm import meta_schedule as ms
from tvm.meta_schedule import TuneContext
from tvm.meta_schedule.runner import RunnerResult
@@ -242,4 +243,4 @@ def test_meta_schedule_evolutionary_search_early_stop(): # pylint: disable = in
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/unittest/test_meta_schedule_space_generator.py b/tests/python/unittest/test_meta_schedule_space_generator.py
index 4e20524f06..84104c8bcf 100644
--- a/tests/python/unittest/test_meta_schedule_space_generator.py
+++ b/tests/python/unittest/test_meta_schedule_space_generator.py
@@ -23,6 +23,7 @@ import math
import pytest
import tvm
+import tvm.testing
from tvm.meta_schedule.utils import derived_object
from tvm.meta_schedule.space_generator import ScheduleFn, PySpaceGenerator, SpaceGeneratorUnion
from tvm.meta_schedule.tune_context import TuneContext
@@ -101,4 +102,4 @@ def test_meta_schedule_design_space_generator_NIE():
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/unittest/test_meta_schedule_task_scheduler.py b/tests/python/unittest/test_meta_schedule_task_scheduler.py
index fdf4d26379..025bbe4225 100644
--- a/tests/python/unittest/test_meta_schedule_task_scheduler.py
+++ b/tests/python/unittest/test_meta_schedule_task_scheduler.py
@@ -23,6 +23,7 @@ from typing import Set
import pytest
import tvm
+import tvm.testing
from tvm._ffi.base import TVMError
from tvm.meta_schedule import TuneContext, measure_callback
from tvm.meta_schedule.search_strategy import ReplayTrace
@@ -365,4 +366,4 @@ def test_meta_schedule_task_scheduler_multiple_gradient_based():
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/unittest/test_meta_schedule_tune_context.py b/tests/python/unittest/test_meta_schedule_tune_context.py
index 01a4379e51..69b38c82a1 100644
--- a/tests/python/unittest/test_meta_schedule_tune_context.py
+++ b/tests/python/unittest/test_meta_schedule_tune_context.py
@@ -20,6 +20,7 @@ import sys
import pytest
import tvm
+import tvm.testing
from tvm.script import tir as T
from tvm.target import Target
from tvm.meta_schedule import TuneContext
@@ -56,4 +57,4 @@ def test_tune_context_create():
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/unittest/test_micro_model_library_format.py b/tests/python/unittest/test_micro_model_library_format.py
index 87b8bcb2b9..ad054479fd 100644
--- a/tests/python/unittest/test_micro_model_library_format.py
+++ b/tests/python/unittest/test_micro_model_library_format.py
@@ -429,6 +429,4 @@ def test_export_byoc_c_module():
if __name__ == "__main__":
- import sys
-
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/unittest/test_micro_project_api.py b/tests/python/unittest/test_micro_project_api.py
index 1dd8940fec..569393c060 100644
--- a/tests/python/unittest/test_micro_project_api.py
+++ b/tests/python/unittest/test_micro_project_api.py
@@ -25,6 +25,7 @@ from unittest import mock
import pytest
import tvm
+import tvm.testing
# Implementing as a fixture so that the tvm.micro import doesn't occur
@@ -494,4 +495,4 @@ def test_invalid_request(BaseTestHandler):
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/unittest/test_micro_transport.py b/tests/python/unittest/test_micro_transport.py
index 2fbfada198..804f83587f 100644
--- a/tests/python/unittest/test_micro_transport.py
+++ b/tests/python/unittest/test_micro_transport.py
@@ -222,4 +222,4 @@ def test_write_keyboard_interrupt(transport, transport_logger, get_latest_log):
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/unittest/test_node_reflection.py b/tests/python/unittest/test_node_reflection.py
index bb300607cf..595067866f 100644
--- a/tests/python/unittest/test_node_reflection.py
+++ b/tests/python/unittest/test_node_reflection.py
@@ -15,6 +15,7 @@
# specific language governing permissions and limitations
# under the License.
import tvm
+import tvm.testing
import sys
import pytest
from tvm import te
@@ -195,4 +196,4 @@ def test_alloc_const():
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/unittest/test_runtime_graph_debug.py b/tests/python/unittest/test_runtime_graph_debug.py
index 9d7bedecab..904e5820e3 100644
--- a/tests/python/unittest/test_runtime_graph_debug.py
+++ b/tests/python/unittest/test_runtime_graph_debug.py
@@ -256,4 +256,4 @@ def test_run_single_node(graph, n, A, myadd):
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/unittest/test_runtime_profiling.py b/tests/python/unittest/test_runtime_profiling.py
index 3cc79ab67a..919057f08d 100644
--- a/tests/python/unittest/test_runtime_profiling.py
+++ b/tests/python/unittest/test_runtime_profiling.py
@@ -358,7 +358,4 @@ def test_roofline_analysis_rpc():
if __name__ == "__main__":
- import sys
- import pytest
-
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/unittest/test_runtime_rpc.py b/tests/python/unittest/test_runtime_rpc.py
index 63be742fdb..255d28a5ef 100644
--- a/tests/python/unittest/test_runtime_rpc.py
+++ b/tests/python/unittest/test_runtime_rpc.py
@@ -34,7 +34,7 @@ from tvm.rpc.proxy import Proxy
if __name__ == "__main__":
# NOTE: must live here to avoid registering PackedFunc with libtvm.so twice.
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
# tkonolige: The issue as I understand it is this: multiprocessing's spawn
diff --git a/tests/python/unittest/test_runtime_vm_profiler.py b/tests/python/unittest/test_runtime_vm_profiler.py
index 45bce024e3..3559e11f8e 100644
--- a/tests/python/unittest/test_runtime_vm_profiler.py
+++ b/tests/python/unittest/test_runtime_vm_profiler.py
@@ -17,6 +17,7 @@
import numpy as np
import tvm
+import tvm.testing
from tvm.runtime import profiler_vm
from tvm import relay
from tvm.relay.testing import mlp
@@ -54,7 +55,4 @@ def test_vm_reshape_and_copy():
if __name__ == "__main__":
- import sys
- import pytest
-
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/unittest/test_target_codegen_bool.py b/tests/python/unittest/test_target_codegen_bool.py
index 0b66165374..b9f4437110 100644
--- a/tests/python/unittest/test_target_codegen_bool.py
+++ b/tests/python/unittest/test_target_codegen_bool.py
@@ -17,6 +17,7 @@
"""codegen related to bool types"""
import tvm
+import tvm.testing
from tvm import te
import numpy as np
import tvm.testing
@@ -71,4 +72,4 @@ def test_cmp_load_store(target, dev, arr_size, compute, schedule):
if __name__ == "__main__":
- sys.exit(pytest.main(sys.argv))
+ tvm.testing.main()
diff --git a/tests/python/unittest/test_target_codegen_hexagon.py b/tests/python/unittest/test_target_codegen_hexagon.py
index 41f0cb1620..344c7a9762 100644
--- a/tests/python/unittest/test_target_codegen_hexagon.py
+++ b/tests/python/unittest/test_target_codegen_hexagon.py
@@ -116,4 +116,4 @@ def test_llvm_options():
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/unittest/test_target_codegen_llvm.py b/tests/python/unittest/test_target_codegen_llvm.py
index 0feab24884..df2a394b16 100644
--- a/tests/python/unittest/test_target_codegen_llvm.py
+++ b/tests/python/unittest/test_target_codegen_llvm.py
@@ -977,4 +977,4 @@ def test_llvm_target_attributes():
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/unittest/test_target_codegen_vulkan.py b/tests/python/unittest/test_target_codegen_vulkan.py
index 931aee33b4..3b42dd61dc 100644
--- a/tests/python/unittest/test_target_codegen_vulkan.py
+++ b/tests/python/unittest/test_target_codegen_vulkan.py
@@ -554,6 +554,4 @@ def test_shared_mem_alloc(target, dev):
if __name__ == "__main__":
- import sys
-
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/unittest/test_target_target.py b/tests/python/unittest/test_target_target.py
index d58c20d063..5a5c17e196 100644
--- a/tests/python/unittest/test_target_target.py
+++ b/tests/python/unittest/test_target_target.py
@@ -19,6 +19,7 @@ import sys
import pytest
import tvm
+import tvm.testing
from tvm.target import Target, arm_cpu, bifrost, cuda, intel_graphics, mali, rocm, vta
@@ -470,4 +471,4 @@ def test_target_attr_bool_value():
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/unittest/test_target_texture_codegen_opencl.py b/tests/python/unittest/test_target_texture_codegen_opencl.py
index acfadc9d51..06876258e5 100644
--- a/tests/python/unittest/test_target_texture_codegen_opencl.py
+++ b/tests/python/unittest/test_target_texture_codegen_opencl.py
@@ -20,6 +20,7 @@ import numpy as np
import pytest
import tvm
+import tvm.testing
from tvm import autotvm
from tvm import te
from tvm.topi import testing
@@ -1397,4 +1398,4 @@ class TestDepthwiseConv2dNCHWcKCRSk(BaseConv2DValidator):
if __name__ == "__main__":
- sys.exit(pytest.main(sys.argv))
+ tvm.testing.main()
diff --git a/tests/python/unittest/test_tir_analysis_estimate_tir_flops.py b/tests/python/unittest/test_tir_analysis_estimate_tir_flops.py
index a516f07473..7aa015831a 100644
--- a/tests/python/unittest/test_tir_analysis_estimate_tir_flops.py
+++ b/tests/python/unittest/test_tir_analysis_estimate_tir_flops.py
@@ -18,6 +18,7 @@
import sys
import pytest
+import tvm.testing
from tvm.ir import IRModule
from tvm.meta_schedule.testing.te_workload import create_te_workload
from tvm.tir.analysis import estimate_tir_flops
@@ -48,4 +49,4 @@ def test_te_workload(workload, flops):
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/unittest/test_tir_renew_defs.py b/tests/python/unittest/test_tir_renew_defs.py
index 26e41477e2..36cc52c169 100644
--- a/tests/python/unittest/test_tir_renew_defs.py
+++ b/tests/python/unittest/test_tir_renew_defs.py
@@ -19,6 +19,7 @@ import pytest
import sys
import tvm
+import tvm.testing
from tvm.script import tir as T
from tvm.tir.buffer import Buffer
from tvm.tir.function import PrimFunc
@@ -168,4 +169,4 @@ def test_symbolic_func():
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/unittest/test_tir_schedule_block_scope.py b/tests/python/unittest/test_tir_schedule_block_scope.py
index ad789a0107..375b6c07c2 100644
--- a/tests/python/unittest/test_tir_schedule_block_scope.py
+++ b/tests/python/unittest/test_tir_schedule_block_scope.py
@@ -19,6 +19,7 @@ import sys
import pytest
import tvm
+import tvm.testing
from tvm import tir
from tvm.script import tir as T
from tvm.tir.schedule import DepKind
@@ -151,4 +152,4 @@ def test_war_dependency():
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/unittest/test_tir_schedule_blockize.py b/tests/python/unittest/test_tir_schedule_blockize.py
index b4a16a8231..481421cfdf 100644
--- a/tests/python/unittest/test_tir_schedule_blockize.py
+++ b/tests/python/unittest/test_tir_schedule_blockize.py
@@ -18,6 +18,7 @@
import sys
import pytest
import tvm
+import tvm.testing
from tvm.script import tir as T
from tvm import tir
from tvm.tir.schedule.testing import verify_trace_roundtrip
@@ -207,4 +208,4 @@ def test_blockize_init_loops():
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/unittest/test_tir_schedule_cache_read_write.py b/tests/python/unittest/test_tir_schedule_cache_read_write.py
index 5ecf615e01..ef306b2c49 100644
--- a/tests/python/unittest/test_tir_schedule_cache_read_write.py
+++ b/tests/python/unittest/test_tir_schedule_cache_read_write.py
@@ -19,6 +19,7 @@ import sys
import pytest
import tvm
+import tvm.testing
from tvm import tir
from tvm.script import tir as T
from tvm.tir.schedule.testing import verify_trace_roundtrip
@@ -925,4 +926,4 @@ def test_cache_write_fail_invalid_storage_scope():
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/unittest/test_tir_schedule_compute_at.py b/tests/python/unittest/test_tir_schedule_compute_at.py
index 25b69aa6de..b06dcebe1d 100644
--- a/tests/python/unittest/test_tir_schedule_compute_at.py
+++ b/tests/python/unittest/test_tir_schedule_compute_at.py
@@ -20,6 +20,7 @@ import sys
import pytest
import tvm
+import tvm.testing
from tvm import tir
from tvm.script import tir as T
from tvm.tir.schedule.testing import verify_trace_roundtrip
@@ -1297,4 +1298,4 @@ def test_fail_all_producers_under_loop():
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/unittest/test_tir_schedule_compute_inline.py b/tests/python/unittest/test_tir_schedule_compute_inline.py
index 057d808ca4..28a83d8eef 100644
--- a/tests/python/unittest/test_tir_schedule_compute_inline.py
+++ b/tests/python/unittest/test_tir_schedule_compute_inline.py
@@ -19,6 +19,7 @@ import sys
import pytest
import tvm
+import tvm.testing
from tvm import tir
from tvm.script import tir as T
from tvm.tir.schedule.testing import verify_trace_roundtrip
@@ -737,4 +738,4 @@ def test_compute_inline_opaque_access_with_tvm_access_ptr():
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/unittest/test_tir_schedule_error.py b/tests/python/unittest/test_tir_schedule_error.py
index 15e13c47e0..99de5305fd 100644
--- a/tests/python/unittest/test_tir_schedule_error.py
+++ b/tests/python/unittest/test_tir_schedule_error.py
@@ -19,6 +19,7 @@ import sys
import pytest
import tvm
+import tvm.testing
from tvm import tir
from tvm.script import tir as T
@@ -74,4 +75,4 @@ def test_tir_schedule_attribute_error():
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/unittest/test_tir_schedule_for_kind.py b/tests/python/unittest/test_tir_schedule_for_kind.py
index 00d97c7339..132e8b8b3f 100644
--- a/tests/python/unittest/test_tir_schedule_for_kind.py
+++ b/tests/python/unittest/test_tir_schedule_for_kind.py
@@ -656,4 +656,4 @@ def test_scatter_parallelize():
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/unittest/test_tir_schedule_instruction.py b/tests/python/unittest/test_tir_schedule_instruction.py
index 9e6f447dd3..1aa78ee68c 100644
--- a/tests/python/unittest/test_tir_schedule_instruction.py
+++ b/tests/python/unittest/test_tir_schedule_instruction.py
@@ -19,6 +19,7 @@
import sys
import pytest
+import tvm.testing
from tvm.tir.schedule import BlockRV, Instruction, InstructionKind, LoopRV
@@ -65,4 +66,4 @@ def test_inst_construct_2():
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/unittest/test_tir_schedule_reduction.py b/tests/python/unittest/test_tir_schedule_reduction.py
index 4be8ebc2c2..a8348afb45 100644
--- a/tests/python/unittest/test_tir_schedule_reduction.py
+++ b/tests/python/unittest/test_tir_schedule_reduction.py
@@ -295,4 +295,4 @@ def test_decompose_reduction_ref_hash_check():
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/unittest/test_tir_schedule_reorder.py b/tests/python/unittest/test_tir_schedule_reorder.py
index 462099e6fe..c5663a5f2e 100644
--- a/tests/python/unittest/test_tir_schedule_reorder.py
+++ b/tests/python/unittest/test_tir_schedule_reorder.py
@@ -19,6 +19,7 @@ import sys
import pytest
import tvm
+import tvm.testing
from tvm import tir
from tvm.script import tir as T
from tvm.tir.schedule.testing import verify_trace_roundtrip
@@ -368,4 +369,4 @@ def test_reorder_fail_not_affine_bindings():
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/unittest/test_tir_schedule_rfactor.py b/tests/python/unittest/test_tir_schedule_rfactor.py
index a533668023..4078b1e896 100644
--- a/tests/python/unittest/test_tir_schedule_rfactor.py
+++ b/tests/python/unittest/test_tir_schedule_rfactor.py
@@ -858,4 +858,4 @@ def test_reduction_rfactor_spatial_only():
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/unittest/test_tir_schedule_sampling.py b/tests/python/unittest/test_tir_schedule_sampling.py
index d8f9670250..17f35ea8f7 100644
--- a/tests/python/unittest/test_tir_schedule_sampling.py
+++ b/tests/python/unittest/test_tir_schedule_sampling.py
@@ -19,6 +19,7 @@ import sys
import numpy
import pytest
+import tvm.testing
from tvm import tir
from tvm.script import tir as T
@@ -206,4 +207,4 @@ def test_sample_perfect_tile_after_copy():
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/unittest/test_tir_schedule_set_axis_separator.py b/tests/python/unittest/test_tir_schedule_set_axis_separator.py
index d829a3f1b7..8c3d1e6735 100644
--- a/tests/python/unittest/test_tir_schedule_set_axis_separator.py
+++ b/tests/python/unittest/test_tir_schedule_set_axis_separator.py
@@ -18,6 +18,7 @@
import sys
import pytest
import tvm
+import tvm.testing
from tvm import tir
from tvm.script import tir as T
from tvm.tir.schedule.testing import verify_trace_roundtrip
@@ -136,4 +137,4 @@ def test_set_axis_separator_subregion():
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/unittest/test_tir_schedule_split_fuse.py b/tests/python/unittest/test_tir_schedule_split_fuse.py
index b5ab45a505..16eef57c47 100644
--- a/tests/python/unittest/test_tir_schedule_split_fuse.py
+++ b/tests/python/unittest/test_tir_schedule_split_fuse.py
@@ -19,6 +19,7 @@ import sys
import pytest
import tvm
+import tvm.testing
from tvm import tir
from tvm.script import tir as T
from tvm.tir.schedule.testing import verify_trace_roundtrip
@@ -524,4 +525,4 @@ def test_fuse_not_affine():
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/unittest/test_tir_schedule_state.py b/tests/python/unittest/test_tir_schedule_state.py
index bc62fa1ba9..db6909a048 100644
--- a/tests/python/unittest/test_tir_schedule_state.py
+++ b/tests/python/unittest/test_tir_schedule_state.py
@@ -20,6 +20,7 @@ import sys
import pytest
import tvm
+import tvm.testing
from tvm import tir
from tvm.ir import IRModule
from tvm.script import tir as T
@@ -351,4 +352,4 @@ def test_replace_ir_module():
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/unittest/test_tir_schedule_state_cached_flags.py b/tests/python/unittest/test_tir_schedule_state_cached_flags.py
index 8b731404f1..1b4c34973f 100644
--- a/tests/python/unittest/test_tir_schedule_state_cached_flags.py
+++ b/tests/python/unittest/test_tir_schedule_state_cached_flags.py
@@ -19,6 +19,7 @@ import sys
import pytest
import tvm
+import tvm.testing
from tvm import tir
from tvm.script import tir as T
from tvm.tir.schedule.state import CachedFlags
@@ -781,4 +782,4 @@ def test_uncovered_producer_region():
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/unittest/test_tir_schedule_tensorize.py b/tests/python/unittest/test_tir_schedule_tensorize.py
index 65dfa06eb6..a97060f01b 100644
--- a/tests/python/unittest/test_tir_schedule_tensorize.py
+++ b/tests/python/unittest/test_tir_schedule_tensorize.py
@@ -646,4 +646,4 @@ def test_tensorize_dpa4():
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/unittest/test_tir_schedule_trace.py b/tests/python/unittest/test_tir_schedule_trace.py
index 1923eb23af..6fc573b1a8 100644
--- a/tests/python/unittest/test_tir_schedule_trace.py
+++ b/tests/python/unittest/test_tir_schedule_trace.py
@@ -20,6 +20,7 @@ import sys
import pytest
import tvm
+import tvm.testing
from tvm import tir
from tvm.script import tir as T
from tvm.tir.schedule import BlockRV, Instruction, InstructionKind, LoopRV, Trace
@@ -275,4 +276,4 @@ def test_apply_json_to_schedule_1():
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/unittest/test_tir_schedule_transform_layout.py b/tests/python/unittest/test_tir_schedule_transform_layout.py
index 35dd2fff53..9e7cad4d85 100644
--- a/tests/python/unittest/test_tir_schedule_transform_layout.py
+++ b/tests/python/unittest/test_tir_schedule_transform_layout.py
@@ -20,6 +20,7 @@ import sys
import pytest
import tvm
+import tvm.testing
from tvm import tir
from tvm.script import tir as T
from tvm.tir.schedule.testing import verify_trace_roundtrip
@@ -159,4 +160,4 @@ def test_simplify():
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/unittest/test_tir_schedule_utilities.py b/tests/python/unittest/test_tir_schedule_utilities.py
index 5ec4a11209..0d23d3f952 100644
--- a/tests/python/unittest/test_tir_schedule_utilities.py
+++ b/tests/python/unittest/test_tir_schedule_utilities.py
@@ -19,6 +19,7 @@ import sys
import pytest
import tvm
+import tvm.testing
from tvm import tir
from tvm.ir import IRModule
@@ -270,4 +271,4 @@ def test_annotate_unannotate_block():
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/unittest/test_tir_texture_scope.py b/tests/python/unittest/test_tir_texture_scope.py
index 701a1fe77a..2af4710751 100644
--- a/tests/python/unittest/test_tir_texture_scope.py
+++ b/tests/python/unittest/test_tir_texture_scope.py
@@ -18,6 +18,7 @@
import pytest
import tvm
+import tvm.testing
from tvm.ir.module import IRModule
from tvm import tir
from tvm.script import tir as T
@@ -59,4 +60,4 @@ def test_texture_scope():
if __name__ == "__main__":
- sys.exit(pytest.main(sys.argv))
+ tvm.testing.main()
diff --git a/tests/python/unittest/test_tir_transform_compact_buffer_region.py b/tests/python/unittest/test_tir_transform_compact_buffer_region.py
index 3e538e27a4..7d3dce870b 100644
--- a/tests/python/unittest/test_tir_transform_compact_buffer_region.py
+++ b/tests/python/unittest/test_tir_transform_compact_buffer_region.py
@@ -17,6 +17,7 @@
import pytest
import sys
import tvm
+import tvm.testing
from tvm import te
from tvm.script import tir as T
@@ -740,4 +741,4 @@ def test_compact_with_let_binding():
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/unittest/test_tir_transform_inject_software_pipeline.py b/tests/python/unittest/test_tir_transform_inject_software_pipeline.py
index ff7e79c023..50f96d052b 100644
--- a/tests/python/unittest/test_tir_transform_inject_software_pipeline.py
+++ b/tests/python/unittest/test_tir_transform_inject_software_pipeline.py
@@ -18,6 +18,7 @@ import pytest
import sys
import tvm
+import tvm.testing
from tvm import tir, te, TVMError
from tvm.script import tir as T
@@ -1022,4 +1023,4 @@ def test_error_missing_annotation():
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/unittest/test_tir_transform_lower_cross_thread_reduction.py b/tests/python/unittest/test_tir_transform_lower_cross_thread_reduction.py
index 2be3bb1811..9b5937ac6e 100644
--- a/tests/python/unittest/test_tir_transform_lower_cross_thread_reduction.py
+++ b/tests/python/unittest/test_tir_transform_lower_cross_thread_reduction.py
@@ -18,6 +18,7 @@ import sys
import pytest
import tvm
+import tvm.testing
from tvm import te
from tvm.script import tir as T
@@ -895,4 +896,4 @@ def test_lower_te():
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/unittest/test_tir_transform_storage_flatten.py b/tests/python/unittest/test_tir_transform_storage_flatten.py
index 44db618175..b84b3479fe 100644
--- a/tests/python/unittest/test_tir_transform_storage_flatten.py
+++ b/tests/python/unittest/test_tir_transform_storage_flatten.py
@@ -15,6 +15,7 @@
# specific language governing permissions and limitations
# under the License.
import tvm
+import tvm.testing
from tvm import te
from tvm.driver.build_module import schedule_to_module
from tvm.script import tir as T
@@ -165,4 +166,4 @@ def test_flatten_tir():
if __name__ == "__main__":
- sys.exit(pytest.main(sys.argv))
+ tvm.testing.main()
diff --git a/tests/python/unittest/test_tir_transform_storage_rewrite.py b/tests/python/unittest/test_tir_transform_storage_rewrite.py
index 083bd9950a..df147e411f 100644
--- a/tests/python/unittest/test_tir_transform_storage_rewrite.py
+++ b/tests/python/unittest/test_tir_transform_storage_rewrite.py
@@ -17,6 +17,7 @@
import sys
import pytest
import tvm
+import tvm.testing
from tvm import te
from tvm.driver.build_module import schedule_to_module
from tvm.script import tir as T
@@ -671,4 +672,4 @@ def test_access_in_let_value():
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/unittest/test_tir_transform_unify_thread_binding.py b/tests/python/unittest/test_tir_transform_unify_thread_binding.py
index 6880aabcd2..457c43a763 100644
--- a/tests/python/unittest/test_tir_transform_unify_thread_binding.py
+++ b/tests/python/unittest/test_tir_transform_unify_thread_binding.py
@@ -18,6 +18,7 @@ import pytest
import sys
import tvm
+import tvm.testing
from tvm import te
from tvm.script import tir as T
@@ -256,4 +257,4 @@ def test_lower_te():
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/unittest/test_tir_usmp_algo_hill_climb.py b/tests/python/unittest/test_tir_usmp_algo_hill_climb.py
index 863b0a566c..44b4e6636b 100644
--- a/tests/python/unittest/test_tir_usmp_algo_hill_climb.py
+++ b/tests/python/unittest/test_tir_usmp_algo_hill_climb.py
@@ -18,6 +18,7 @@ import sys
import pytest
import random
import tvm
+import tvm.testing
from tvm.tir.usmp.utils import BufferInfo, PoolInfo
@@ -391,4 +392,4 @@ def run_intervals(intervals):
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/unittest/test_transform_layout.py b/tests/python/unittest/test_transform_layout.py
index e7d5f125dc..18b3774176 100755
--- a/tests/python/unittest/test_transform_layout.py
+++ b/tests/python/unittest/test_transform_layout.py
@@ -576,4 +576,4 @@ def test_size_one_buffer(shape, transform):
if __name__ == "__main__":
- sys.exit(pytest.main(sys.argv))
+ tvm.testing.main()
diff --git a/tests/python/unittest/test_tvm_testing_features.py b/tests/python/unittest/test_tvm_testing_features.py
index c00fc02c43..5c0e526f0d 100644
--- a/tests/python/unittest/test_tvm_testing_features.py
+++ b/tests/python/unittest/test_tvm_testing_features.py
@@ -291,4 +291,4 @@ class TestCacheableTypes:
if __name__ == "__main__":
- sys.exit(pytest.main(sys.argv))
+ tvm.testing.main()
diff --git a/tests/python/unittest/test_tvmscript_error_report.py b/tests/python/unittest/test_tvmscript_error_report.py
index 070b5e85f1..c3dfb32211 100644
--- a/tests/python/unittest/test_tvmscript_error_report.py
+++ b/tests/python/unittest/test_tvmscript_error_report.py
@@ -664,4 +664,4 @@ def test_illegal_buffer_slice():
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/unittest/test_tvmscript_roundtrip.py b/tests/python/unittest/test_tvmscript_roundtrip.py
index f6db826dfd..93bd0707c6 100644
--- a/tests/python/unittest/test_tvmscript_roundtrip.py
+++ b/tests/python/unittest/test_tvmscript_roundtrip.py
@@ -3335,4 +3335,4 @@ def test_roundtrip(ir_generator):
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()
diff --git a/tests/python/unittest/test_tvmscript_syntax_sugar.py b/tests/python/unittest/test_tvmscript_syntax_sugar.py
index b3fe5674a8..0da80d80cf 100644
--- a/tests/python/unittest/test_tvmscript_syntax_sugar.py
+++ b/tests/python/unittest/test_tvmscript_syntax_sugar.py
@@ -18,6 +18,7 @@
import sys
import pytest
+import tvm.testing
from tvm.ir import assert_structural_equal
from tvm.script import tir as T
from tvm.script.parser import from_source
@@ -347,4 +348,4 @@ def test_func_call():
if __name__ == "__main__":
- sys.exit(pytest.main([__file__] + sys.argv[1:]))
+ tvm.testing.main()