|
5 | 5 | # Use true division operator always even in old python 2.x (used in `_extract_cases_from_module`) |
6 | 6 | from __future__ import division |
7 | 7 |
|
| 8 | +from collections import namedtuple |
| 9 | + |
8 | 10 | import functools |
9 | 11 | from importlib import import_module |
10 | 12 | from inspect import getmembers, ismodule |
@@ -1005,6 +1007,9 @@ def get_current_param(value, argname_or_fixturename, mp_fix_to_args): |
1005 | 1007 | return argnames, actual_value, parametrized |
1006 | 1008 |
|
1007 | 1009 |
|
| 1010 | +Case = namedtuple("Case", ("id", "func", "params")) |
| 1011 | + |
| 1012 | + |
1008 | 1013 | def get_current_cases(request_or_item): |
1009 | 1014 | """ |
1010 | 1015 | Returns a dictionary containing all case parameters for the currently active `pytest` item. |
@@ -1077,7 +1082,7 @@ def _do(name, value, dct, preserve=False): |
1077 | 1082 | pass |
1078 | 1083 |
|
1079 | 1084 | # Finally fill the results |
1080 | | - dct[name] = (case_id, case_func, case_params_dct) |
| 1085 | + dct[name] = Case(case_id, case_func, case_params_dct) |
1081 | 1086 |
|
1082 | 1087 | elif preserve: |
1083 | 1088 | # used in nested scenarii |
@@ -1105,9 +1110,12 @@ def _do(name, value, dct, preserve=False): |
1105 | 1110 | except KeyError: |
1106 | 1111 | pass |
1107 | 1112 |
|
1108 | | - # merge the two |
1109 | | - cases_res_dict_fixs.update(cases_res_dict) |
1110 | | - return cases_res_dict_fixs |
| 1113 | + # merge the two - put the fixtures at the end |
| 1114 | + for k, v in cases_res_dict_fixs.items(): |
| 1115 | + if k not in cases_res_dict: |
| 1116 | + cases_res_dict[k] = v |
| 1117 | + |
| 1118 | + return cases_res_dict |
1111 | 1119 |
|
1112 | 1120 |
|
1113 | 1121 | def _get_place_as(f): |
|
0 commit comments