Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation Suggestion #305

Open
ImplyingICheck opened this issue Jul 16, 2023 · 1 comment
Open

Documentation Suggestion #305

ImplyingICheck opened this issue Jul 16, 2023 · 1 comment

Comments

@ImplyingICheck
Copy link

ImplyingICheck commented Jul 16, 2023

Background

I was recently having a tough time tracking down an issue with my test set up. After a while of trying everything I could and reading the API reference, I started browsing the other pages of the GitHub site. Browsing through the Home page, I found a line of documentation that solved the issue I was having.

Problem

Currently, the line

However WARNING: only the case functions defined BEFORE the test function in the module file will be taken into account!

only appears under the Alternate source(s) section of Home. It would be nice to have some reference to this warning in the API reference page of the GitHub site; specifically, under the documentation for @parametrize_with_cases.

Code Suggestion

It could be a nice feature to display a warning when a function using @parametrize_with_cases(cases='THIS_MODULE') is skipped by Pytest due getting an "empty parameter set". However, I am not familiar with the inner workings of pytest-cases, so I have no clue as to how much effort something like this would take to implement.

@smarie
Copy link
Owner

smarie commented Nov 10, 2023

Thanks @ImplyingICheck for reporting this issue, and very sorry for the long delay in answering !

Indeed, the documentation is probably a bit light on this, would you like to propose a PR modifying the API reference page (and the corresponding code docstring) ?

Concerning your suggestion for a warning, it could be done just after this line:

https://github.com/smarie/python-pytest-cases/blob/main/src/pytest_cases/case_parametrizer_new.py#L143C9-L143C20

        # Collect all cases
        cases_funs = get_all_cases(f, cases=cases, prefix=prefix, glob=glob, has_tag=has_tag, filter=filter)

        # TODO if `cases_funs` is empty (and possibly on other conditions to limit the annoyance ?), construct a warning

However would it be correctly displayed by pytest ? Here again if you are interested feel free to propose a PR (it can be the same PR)

Thanks again for your feedback and interesting proposals !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants