From 63f9b206acda7b207a8956eefe539b151df77dbe Mon Sep 17 00:00:00 2001 From: Prashant Kumar Date: Tue, 17 May 2022 11:13:51 +0000 Subject: [PATCH] Modify pytest to run a certain test. --- pytest.ini | 2 +- shark/examples/test_models.py | 30 ++++++++---------------------- 2 files changed, 9 insertions(+), 23 deletions(-) diff --git a/pytest.ini b/pytest.ini index e1ee8b79..58b25513 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,4 +1,4 @@ [pytest] -addopts = --workers auto --verbose -p no:warnings +addopts = --workers auto -m cpu_static --verbose -p no:warnings norecursedirs = inference diff --git a/shark/examples/test_models.py b/shark/examples/test_models.py index ca5017f3..c61b6b7a 100644 --- a/shark/examples/test_models.py +++ b/shark/examples/test_models.py @@ -78,29 +78,15 @@ def compare_tensors(torch_tensor, numpy_tensor): ############################# Model Tests #################################### -# Please remove the skip flag to run the test with required param. +# A specific case can be run with -m parameter. For eg., to run gpu - static +# case for all models it can be run by `pytest -m gpu_static` command. pytest_param = pytest.mark.parametrize(('dynamic', 'device'), [ - pytest.param(False, 'cpu'), - pytest.param( - True, - 'cpu', - marks=pytest.mark.skip(reason="dynamic-shape is not supported.")), - pytest.param( - False, - 'gpu', - marks=pytest.mark.skip(reason="device in the CI not supported.")), - pytest.param( - True, - 'gpu', - marks=pytest.mark.skip(reason="device in the CI not supported.")), - pytest.param( - False, - 'vulkan', - marks=pytest.mark.skip(reason="device in the CI not supported.")), - pytest.param( - True, - 'vulkan', - marks=pytest.mark.skip(reason="device in the CI not supported.")), + pytest.param(False, 'cpu', marks=pytest.mark.cpu_static), + pytest.param(True, 'cpu', marks=pytest.mark.cpu_dynamic), + pytest.param(False, 'gpu', marks=pytest.mark.gpu_static), + pytest.param(True, 'gpu', marks=pytest.mark.gpu_dynamic), + pytest.param(False, 'vulkan', marks=pytest.mark.vulkan_static), + pytest.param(True, 'vulkan', marks=pytest.mark.vulkan_dynamic), ])