Skip to content

regression: testdir fixture not found with pytester plugin loaded #9280

Closed
@The-Compiler

Description

@The-Compiler

After #9208, this:

pytest_plugins = 'pytester'

def test_testdir(testdir):
    pass

fails with:

============================= test session starts ==============================
platform linux -- Python 3.9.7, pytest-7.0.0.dev294+g86446edc8, pluggy-1.0.0
rootdir: /home/florian/tmp/td
collected 1 item                                                               

test_td.py E                                                             [100%]

==================================== ERRORS ====================================
________________________ ERROR at setup of test_testdir ________________________
file /home/florian/tmp/td/test_td.py, line 3
  def test_testdir(testdir):
E       fixture 'testdir' not found
>       available fixtures: LineMatcher, _config_for_test, _pytest, _sys_snapshot, cache, capfd, capfdbinary, caplog, capsys, capsysbinary, doctest_namespace, linecomp, monkeypatch, pytestconfig, pytester, 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/florian/tmp/td/test_td.py:3
=========================== short test summary info ============================
ERROR test_td.py::test_testdir
=============================== 1 error in 0.01s ===============================

I bisected this to e6eac28.

Considering this as a showstopper for 7.0 given that this is a very common way of accessing the testdir fixture.

cc @bluetech

Metadata

Metadata

Assignees

No one assigned

    Labels

    plugin: pytesterrelated to the pytester builtin plugintype: bugproblem that needs to be addressedtype: regressionindicates a problem that was introduced in a release which was working previously

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions