|
22 | 22 | from .common_others import get_code_first_line, AUTO, qname, funcopy, needs_binding, get_function_host, \ |
23 | 23 | in_same_module, get_host_module, get_class_that_defined_method |
24 | 24 | from .common_pytest_marks import copy_pytest_marks, make_marked_parameter_value, remove_pytest_mark, filter_marks, \ |
25 | | - get_param_argnames_as_list |
| 25 | + get_param_argnames_as_list, Mark |
26 | 26 | from .common_pytest_lazy_values import LazyValue, LazyTuple, LazyTupleItem |
27 | 27 | from .common_pytest import safe_isclass, MiniMetafunc, is_fixture, get_fixture_name, inject_host, add_fixture_params, \ |
28 | 28 | list_all_fixtures_in, get_pytest_request_and_item, safe_isinstance |
@@ -269,8 +269,8 @@ def get_all_cases(parametrization_target, # type: Callable |
269 | 269 | for c in cases: |
270 | 270 | # load case or cases depending on type |
271 | 271 | if safe_isclass(c): |
272 | | - # class |
273 | | - new_cases = extract_cases_from_class(c, case_fun_prefix=prefix, check_name=False) # do not check name, it was explicitly passed |
| 272 | + # class - do not check name, it was explicitly passed |
| 273 | + new_cases = extract_cases_from_class(c, case_fun_prefix=prefix, check_name=False) |
274 | 274 | cases_funs += new_cases |
275 | 275 | elif callable(c): |
276 | 276 | # function |
@@ -303,7 +303,7 @@ def get_parametrize_args(host_class_or_module, # type: Union[Type, ModuleType |
303 | 303 | import_fixtures=False, # type: bool |
304 | 304 | debug=False # type: bool |
305 | 305 | ): |
306 | | - # type: (...) -> List[Union[lazy_value, fixture_ref]] |
| 306 | + # type: (...) -> List[CaseParamValue] |
307 | 307 | """ |
308 | 308 | Transforms a list of cases (obtained from `get_all_cases`) into a list of argvalues for `@parametrize`. |
309 | 309 | Each case function `case_fun` is transformed into one or several `lazy_value`(s) or a `fixture_ref`: |
@@ -387,7 +387,7 @@ def case_to_argvalues(host_class_or_module, # type: Union[Type, ModuleType] |
387 | 387 | import_fixtures=False, # type: bool |
388 | 388 | debug=False # type: bool |
389 | 389 | ): |
390 | | - # type: (...) -> Tuple[lazy_value] |
| 390 | + # type: (...) -> Tuple[CaseParamValue, ...] |
391 | 391 | """Transform a single case into one or several `lazy_value`(s) or a `fixture_ref` to be used in `@parametrize` |
392 | 392 |
|
393 | 393 | If `case_fun` requires at least on fixture, a fixture will be created if not yet present, and a `fixture_ref` will |
@@ -464,7 +464,7 @@ def get_or_create_case_fixture(case_id, # type: str |
464 | 464 | import_fixtures=False, # type: bool |
465 | 465 | debug=False # type: bool |
466 | 466 | ): |
467 | | - # type: (...) -> Tuple[str, Tuple[MarkInfo]] |
| 467 | + # type: (...) -> Tuple[str, Tuple[Mark]] |
468 | 468 | """ |
469 | 469 | When case functions require fixtures, we want to rely on pytest to inject everything. Therefore |
470 | 470 | we create a "case fixture" wrapping the case function. Since a case function may not be located in the same place |
@@ -529,8 +529,8 @@ def get_or_create_case_fixture(case_id, # type: str |
529 | 529 | for f in list_all_fixtures_in(true_case_func_host, recurse_to_module=False, return_names=False): |
530 | 530 | f_name = get_fixture_name(f) |
531 | 531 | if (f_name in existing_fixture_names) or (f.__name__ in existing_fixture_names): |
532 | | - raise ValueError("Cannot import fixture %r from %r as it would override an existing symbol in " |
533 | | - "%r. Please set `@parametrize_with_cases(import_fixtures=False)`" |
| 532 | + raise ValueError("Cannot import fixture %r from %r as it would override an existing symbol " |
| 533 | + "in %r. Please set `@parametrize_with_cases(import_fixtures=False)`" |
534 | 534 | "" % (f, from_module, target_host)) |
535 | 535 | target_host_module = target_host if not target_in_class else get_host_module(target_host) |
536 | 536 | setattr(target_host_module, f.__name__, f) |
@@ -786,7 +786,8 @@ def _of_interest(x): # noqa |
786 | 786 | for m_name, m in getmembers(container, _of_interest): |
787 | 787 | if is_case_class(m): |
788 | 788 | co_firstlineno = get_code_first_line(m) |
789 | | - cls_cases = extract_cases_from_class(m, case_fun_prefix=case_fun_prefix, _case_param_factory=_case_param_factory) |
| 789 | + cls_cases = extract_cases_from_class(m, case_fun_prefix=case_fun_prefix, |
| 790 | + _case_param_factory=_case_param_factory) |
790 | 791 | for _i, _m_item in enumerate(cls_cases): |
791 | 792 | gen_line_nb = co_firstlineno + (_i / len(cls_cases)) |
792 | 793 | cases_dct[gen_line_nb] = _m_item |
|
0 commit comments