Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
[PyTest] Sort by test location, but not parametrization
A follow-up from #9188.  The
`item.location` tuple contains `(filename, line_number, test_name)`,
where the `test_name` includes a string representation of all
parameters.  This change preserves pytest's sorting of parametrized
values within a parametrized test, rather than sorting by strings.
  • Loading branch information
Lunderberg committed Oct 22, 2021
commit 38cfafbf9cda5d9df95b3b6256a855250cb1d9db
8 changes: 7 additions & 1 deletion python/tvm/testing/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,13 @@ def _sort_tests(items):
Should be called from pytest_collection_modifyitems.

"""
items.sort(key=lambda item: item.location)

def sort_key(item):
filename, lineno, test_name = item.location
test_name = test_name.split("[")[0]
return filename, lineno, test_name

items.sort(key=sort_key)


def _target_to_requirement(target):
Expand Down