python-pytest-cases icon indicating copy to clipboard operation
python-pytest-cases copied to clipboard

fix: Allow loading cases for tests.py

Open last-partizan opened this issue 1 year ago • 1 comments
trafficstars

Hi, i noticed that after updating to 3.8.5 this package stopped loading cases from tests_cases.py.

This PR fixes it.

Can this be accepted? Or it's better for me to rename my tests.py to test_something.py?

last-partizan avatar Jun 01 '24 14:06 last-partizan

@smarie Please, review this.

last-partizan avatar Oct 17 '24 12:10 last-partizan

Hi @last-partizan , I looked at your PR and slightly improved it.

Now my problem is that the test does not seem to run at all :)

Could it be that this correspond to an old behaviour from pytest ? Maybe pytest does not run anymore a collected file that is named tests.py .

smarie avatar Aug 25 '25 06:08 smarie

Yes. It seems to be the case.

By default, files matching test_*.py and *_test.py will be considered test modules.

I think pytest never collected tests.py by default, but I have this configured in pytest.ini

python_files = tests.py test_*.py *_tests.py

last-partizan avatar Aug 25 '25 07:08 last-partizan