Skip to content

False-positive: Starting from version 4.0.0 false-positive on pytest-bdd fixtures #10665

@measles

Description

@measles

Bug description

We have a set of `pytest_bdd` based tests, where every step is decorated with its description and has the same name `_`. Up until version 4.0.0, it was not a problem. But now every single step description after the first one emits a failed test `function-redefined`. Nothing was changed in a code and if I

Configuration

Command used

± uv run pylint -j 0 example.py

Pylint output

************* Module example
example.py:15:0: E0102: function already defined line 10 (function-redefined)
example.py:20:0: E0102: function already defined line 10 (function-redefined)

------------------------------------------------------------------
Your code has been rated at 0.00/10 (previous run: 0.00/10, +0.00)

Expected behavior

Same as it was in versions before 4.0.0:

************* Module example
example.py:15:0: E0102: function already defined line 10 (function-redefined)
example.py:20:0: E0102: function already defined line 10 (function-redefined)

------------------------------------------------------------------
Your code has been rated at 0.00/10 (previous run: 0.00/10, +0.00)

This is an example for pytest version 3.3.9 on the very same file. File itself:

example.py

.

Pylint version

debian:
± uv run  pylint --version
pylint 3.3.9
astroid 3.3.11
Python 3.13.5 (main, Jun 25 2025, 18:55:22) [GCC 14.2.0]

Same on Ubuntu:
± pylint --version
pylint 4.0.0
astroid 4.0.1
Python 3.13.5 (main, Jun 12 2025, 08:56:14) [GCC 13.3.0]

OS / Environment

Debian:
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 13 (trixie)
Release: 13
Codename: trixie

Ubuntu:
± lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 24.04.2 LTS
Release: 24.04
Codename: noble

Additional dependencies

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs triage 📥Just created, needs acknowledgment, triage, and proper labelling

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions