Skip to content

Pytest 8: AttributeError: 'TestExpectedException' object has no attribute 'runTest'. Did you mean: 'subTest'? #372

@hrnciar

Description

@hrnciar

Hello,

we are using pytest for running bandit and python-etcd3gw tests. Since pytest 8 the tests are failing with AttributeError: 'XXX' object has no attribute 'runTest'. Did you mean: 'subTest'?
See:

Reproducer:

$ git clone git@github.com:testing-cabal/testtools.git
$ cd testtools
[testtools (master)]$ tox -e py312
...

[testtools (master)]$ .tox/py312/bin/pip install 'pytest>=8'
[testtools (master)]$ .tox/py312/bin/pytest testtools/tests
...
AttributeError: 'TestExpectedException' object has no attribute 'runTest'. Did you mean: 'subTest'?
11 warnings, 218 errors

[testtools (master)]$ .tox/py312/bin/pip install 'pytest<8'
[testtools (master)]$ .tox/py312/bin/pytest testtools/tests
...
38 failed, 1328 passed, 7 skipped, 2 xfailed, 59 warnings

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions