diff --git a/docs/changelog.md b/docs/changelog.md index 4121a183..b6efac93 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -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) diff --git a/src/pytest_cases/case_parametrizer_new.py b/src/pytest_cases/case_parametrizer_new.py index 4aa6ce50..361b742e 100644 --- a/src/pytest_cases/case_parametrizer_new.py +++ b/src/pytest_cases/case_parametrizer_new.py @@ -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]] @@ -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 diff --git a/tests/cases/issues/issue_258/test_issue_258.py b/tests/cases/issues/issue_258/test_issue_258.py index bb1fa37b..6bdc96ab 100644 --- a/tests/cases/issues/issue_258/test_issue_258.py +++ b/tests/cases/issues/issue_258/test_issue_258.py @@ -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}