fixtures: remove a no longer needed sort
Dicts these days preserve order, so the sort is no longer needed to achieve determinism. As shown by the `test_dynamic_parametrized_ordering` test, this can change the ordering of items, but only in equivalent ways (same number of setups/teardowns per scope), it will just respect the user's given ordering better (hence `vxlan` items now ordered before `vlan` items compared to the previous ordering).
This commit is contained in:
parent
2007cf6296
commit
9bea1be215
|
@ -172,10 +172,7 @@ def get_parametrized_fixture_keys(
|
||||||
callspec: CallSpec2 = item.callspec # type: ignore[attr-defined]
|
callspec: CallSpec2 = item.callspec # type: ignore[attr-defined]
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
return
|
return
|
||||||
# cs.indices is random order of argnames. Need to
|
for argname in callspec.indices:
|
||||||
# sort this so that different calls to
|
|
||||||
# get_parametrized_fixture_keys will be deterministic.
|
|
||||||
for argname in sorted(callspec.indices):
|
|
||||||
if callspec._arg2scope[argname] != scope:
|
if callspec._arg2scope[argname] != scope:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|
|
@ -2730,12 +2730,12 @@ class TestFixtureMarker:
|
||||||
"""
|
"""
|
||||||
test_dynamic_parametrized_ordering.py::test[flavor1-vxlan] PASSED
|
test_dynamic_parametrized_ordering.py::test[flavor1-vxlan] PASSED
|
||||||
test_dynamic_parametrized_ordering.py::test2[flavor1-vxlan] PASSED
|
test_dynamic_parametrized_ordering.py::test2[flavor1-vxlan] PASSED
|
||||||
test_dynamic_parametrized_ordering.py::test[flavor2-vxlan] PASSED
|
|
||||||
test_dynamic_parametrized_ordering.py::test2[flavor2-vxlan] PASSED
|
|
||||||
test_dynamic_parametrized_ordering.py::test[flavor2-vlan] PASSED
|
|
||||||
test_dynamic_parametrized_ordering.py::test2[flavor2-vlan] PASSED
|
|
||||||
test_dynamic_parametrized_ordering.py::test[flavor1-vlan] PASSED
|
test_dynamic_parametrized_ordering.py::test[flavor1-vlan] PASSED
|
||||||
test_dynamic_parametrized_ordering.py::test2[flavor1-vlan] PASSED
|
test_dynamic_parametrized_ordering.py::test2[flavor1-vlan] PASSED
|
||||||
|
test_dynamic_parametrized_ordering.py::test[flavor2-vlan] PASSED
|
||||||
|
test_dynamic_parametrized_ordering.py::test2[flavor2-vlan] PASSED
|
||||||
|
test_dynamic_parametrized_ordering.py::test[flavor2-vxlan] PASSED
|
||||||
|
test_dynamic_parametrized_ordering.py::test2[flavor2-vxlan] PASSED
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue