Skip to content

Commit

Permalink
[UnitTests] Bugfix for auto parametrizing of "target"
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Lunderberg committed May 25, 2021
1 parent 6927a66 commit 3e7fcb6
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions python/tvm/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -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", [])
Expand Down

0 comments on commit 3e7fcb6

Please sign in to comment.