Skip to content

[behave] Add step matcher functions - #16564

Open
Blacksujit wants to merge 2 commits into
python:mainfrom
Blacksujit:behave-step-matchers
Open

Blacksujit wants to merge 2 commits into
python:mainfrom
Blacksujit:behave-step-matchers

Conversation

@Blacksujit

Copy link
Copy Markdown
Contributor

behave re-exports register_type, use_step_matcher, use_default_step_matcher and the deprecated step_matcher from behave.api.step_matchers (see behave/__init__.py), but the stubs were missing them, so from behave import use_step_matcher was an error. This adds them, and adds them to __all__.

AI agent used: Claude Code (claude-opus-5-5).

@github-actions

This comment has been minimized.

@github-actions

Copy link
Copy Markdown
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

scipy-stubs (https://github.com/scipy/scipy-stubs)
+ tests/misc/test_submodules_empty.pyi:3: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports

@JelleZijlstra

Copy link
Copy Markdown
Member

Why didn't stubtest catch this?

@Blacksujit

Copy link
Copy Markdown
Contributor Author

Because stubs/behave/METADATA.toml sets ignore-missing-stub = true (the stubs are partial), so stubtest does not report runtime names that are missing from the stub. With that flag turned off locally, stubtest lists behave.register_type, behave.step_matcher, behave.use_default_step_matcher, behave.use_step_matcher and the behave.__all__ mismatch among the missing names. This PR fixes those.

@srittau srittau left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one nit below.

from typing import Any
from typing_extensions import deprecated

def register_type(**kwargs: Callable[[str], Any]) -> None: ...

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-obvious Any annotations need to be documented.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants