I wrote a testcase like this, but it doesn't work.
import pytest
@pytest.fixture()
def my_fixture():
print('begin')
print('#####################################')
class TestA():
# @pytest.mark.usefixtures('my_fixture')
def test_a(self, my_fixture, a):
print("{}".format(a))
if __name__ == '__main__':
pytest.main()
the raise error:
E fixture 'a' not found
> available fixtures: cache, capfd, capfdbinary, caplog, capsys, capsysbinary, doctest_namespace, extra, include_metadata_in_junit_xml, login_and_exit, metadata, monkeypatch, my_fixture, 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.
I don't know why......