Reputation: 31908
I want to write descriptive names for my tests, which makes the names long.
Is it possible to avoid having to call a test test_<something>
and instead use a decorator or something else? Or can this be done via some command line arguments?
Upvotes: 1
Views: 2739
Reputation: 16433
You can set it in py.test config, e.g. treat all check_*.py
as tests files and all functions like *_spec
as tests:
# content of setup.cfg
# can also be defined in in tox.ini or pytest.ini file
[pytest]
python_files=check_*.py
python_functions=*_spec
See more at https://pytest.org/latest/example/pythoncollection.html#change-naming-conventions
Upvotes: 6