I want to use a specific method to be run using py.test
, and I have seen several suggestions like HERE and HERE, but for some reasons these answers do not work.
I have a file mytest.py
which has a method special_test
which I want to start with py.test
. And neither
py.test mytest.py::special_test
nor
py.test mytest.py -k special_test
do work.
In the first example I get an ERROR: not found
and in the second example it just says no tests ran
.
What am I missing here?
Content of mytest.py
:
def special_test():
assert True
test_
, otherwise they won't be recognized as a test (this can be changed, though). As an aside: usingpy.test
is long deprecated, usepytest
instead.test_
?pytest.ini
(for example by settingpython_files = *.py
).