From 3e7fcb6b9217a93118e48c1d6a50e84c32a2970e Mon Sep 17 00:00:00 2001 From: Eric Lunderberg Date: Tue, 25 May 2021 14:59:45 -0700 Subject: [PATCH] [UnitTests] Bugfix for auto parametrizing of "target" Previously, if the @parametrize_targets were present, but had other @pytest.mark.parametrize after it, "target" would get parametrized a second time. Now, it checks more than just the closest "parametrize" marker. --- python/tvm/testing.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/python/tvm/testing.py b/python/tvm/testing.py index 10a1d903c1a72..8fbba56da57a8 100644 --- a/python/tvm/testing.py +++ b/python/tvm/testing.py @@ -763,8 +763,13 @@ def _auto_parametrize_target(metafunc): """ if "target" in metafunc.fixturenames: - mark = metafunc.definition.get_closest_marker("parametrize") - if not mark or "target" not in mark.args[0]: + parametrized_args = [ + arg.strip() + for mark in metafunc.definition.iter_markers("parametrize") + for arg in mark.args[0].split(",") + ] + + if "target" not in parametrized_args: # Check if the function is marked with either excluded or # known failing targets. excluded_targets = getattr(metafunc.function, "tvm_excluded_targets", [])