Со следующей конфигурацией файла:
### contents of my_module.py
def testtime_func(path):
pass
### contents of my_test.py
from my_module import testtime_func
def test():
testtime_func(1)
assert True
Команда pytest my_test.py
завершается с ошибкой:
============================================================= test session starts =============================================================
platform linux -- Python 3.6.7, pytest-5.4.1, py-1.8.1, pluggy-0.13.1
rootdir: /home/zaccharie/workspace/tests/pytest_failing
plugins: typeguard-2.7.1
collected 2 items
my_test.py E. [100%]
=================================================================== ERRORS ====================================================================
_______________________________________________________ ERROR at setup of testtime_func _______________________________________________________
file /home/zaccharie/workspace/tests/pytest_failing/my_module.py, line 1
def testtime_func(path):
E fixture 'path' not found
> available fixtures: cache, capfd, capfdbinary, caplog, capsys, capsysbinary, doctest_namespace, monkeypatch, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory
> use 'pytest --fixtures [testpath]' for help on them.
/home/zaccharie/workspace/tests/pytest_failing/my_module.py:1
=========================================================== short test summary info ===========================================================
ERROR my_test.py::testtime_func
========================================================= 1 passed, 1 error in 0.01s ==========================================================
Я не понимаю, почему pytest
ищет тестовую функцию вне указанный путь (но они импортированы).
Я пробовал ремень и подтяжки, также настроив тестовые пути , но безрезультатно.