Skip to content

Commit

Permalink
get_all_cases : fixed default value for cases (#291)
Browse files Browse the repository at this point in the history
* Fixed issue with `get_all_cases`: default value for `cases` was wrong. Fixes #290

* changelog

---------

Co-authored-by: Sylvain MARIE <[email protected]>
  • Loading branch information
smarie and Sylvain MARIE committed Feb 23, 2023
1 parent cbe663d commit 584a51f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
4 changes: 4 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

### 3.6.14 - bugfix

- Fixed issue with `get_all_cases`: default value for `cases` was wrong. Fixes [#290](https://github.com/smarie/python-pytest-cases/issues/290)

### 3.6.13 - bugfix

- Fixed issue where a lazy value (for example a case function) was not resolved before being injected in a parametrized function, and was therefore appearing as a `_LazyValueCaseParamValue `. Fixed [#274](https://github.com/smarie/python-pytest-cases/issues/274)
Expand Down
4 changes: 2 additions & 2 deletions src/pytest_cases/case_parametrizer_new.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ def _glob_name_filter(case_fun):


def get_all_cases(parametrization_target=None, # type: Callable
cases=None, # type: Union[CaseType, List[CaseType]]
cases=AUTO, # type: Union[CaseType, List[CaseType]]
prefix=CASE_PREFIX_FUN, # type: str
glob=None, # type: str
has_tag=None, # type: Union[str, Iterable[str]]
Expand Down Expand Up @@ -675,7 +675,7 @@ def import_default_cases_module(test_module_name):
# Nothing worked
raise ValueError("Error importing test cases module to parametrize %r: unable to import AUTO "
"cases module %r nor %r. Maybe you wish to import cases from somewhere else ? In that case"
"please specify `cases=...`."
" please specify `cases=...`."
% (test_module_name, cases_module_name1, cases_module_name2))

return cases_module
Expand Down
8 changes: 6 additions & 2 deletions tests/cases/issues/issue_258/test_issue_258.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,12 @@ def test_relative_module_cases():
assert {"hello .", "hi ."} == {f() for f in relative_import_cases}


def test_auto_cases():
auto_import_cases = get_all_cases(cases=AUTO)
@parametrize("explicit", (True, False))
def test_auto_cases(explicit):
if explicit:
auto_import_cases = get_all_cases(cases=AUTO)
else:
auto_import_cases = get_all_cases()
assert {"hello AUTO", "hi AUTO"} == {f() for f in auto_import_cases}


Expand Down

0 comments on commit 584a51f

Please sign in to comment.