Skip to content

unable to supress 'already defined on line' errors in idiomatic behave #6278

@mikedlr

Description

@mikedlr

Please provide more information to help us understand the issue:

The standard idiom for behave steps is to reuse the step_impl() function name for each step definition. Since step functions are looked up through a separate function this makes sense.

With mypy it seems impossible to supress the messages that occur

features/steps/add.py:11: error: Name 'step_impl' already defined on line 6
features/steps/add.py:16: error: Name 'step_impl' already defined on line 6
features/steps/add.py:21: error: Name 'step_impl' already defined on line 6

This means that code which is otherwise correct fails.

The actual behavior can be seen with the following commands

  • git clone -b pass_mypy git@github.com:mikedlr/behave_minimal_example.git
  • cd behave_minimal_example/
  • mypy features/steps/add.py

which outputs:

features/steps/add.py:11: error: Name 'step_impl' already defined on line 6
features/steps/add.py:16: error: Name 'step_impl' already defined on line 6
features/steps/add.py:21: error: Name 'step_impl' already defined on line 6

the expected behavior would be to show no errors.

$ python --version
Python 3.6.7
$ mypy --version
mypy 0.660

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions