Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pyrightconfig.stricter.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"stubs/auth0-python",
"stubs/Authlib",
"stubs/aws-xray-sdk",
"stubs/behave",
"stubs/boltons",
"stubs/braintree",
"stubs/cffi",
Expand Down
6 changes: 6 additions & 0 deletions stubs/behave/METADATA.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version = "1.3.*"
upstream_repository = "https://github.com/behave/behave"
partial_stub = true

[tool.stubtest]
ignore_missing_stub = true
13 changes: 13 additions & 0 deletions stubs/behave/behave/__init__.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from behave.fixture import fixture as fixture, use_fixture as use_fixture
from behave.step_registry import (
Given as Given,
Step as Step,
Then as Then,
When as When,
given as given,
step as step,
then as then,
when as when,
)

__all__ = ["given", "when", "then", "step", "Given", "When", "Then", "Step", "use_fixture", "fixture"]
13 changes: 13 additions & 0 deletions stubs/behave/behave/fixture.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from collections.abc import Callable
from typing import Any, Concatenate, ParamSpec, TypeVar

from behave.runner import Context

_T = TypeVar("_T")
_F = TypeVar("_F", bound=Callable[..., Any])
_P = ParamSpec("_P")

def use_fixture(
fixture_func: Callable[Concatenate[Context, _P], _T], context: Context, *fixture_args: _P.args, **fixture_kwargs: _P.kwargs
) -> _T: ...
def fixture(func: _F | None = None, name: str | None = None, pattern: str | None = None) -> _F: ...
Comment thread
hoel-bagard marked this conversation as resolved.
35 changes: 35 additions & 0 deletions stubs/behave/behave/runner.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
from _typeshed import Incomplete
from collections.abc import Callable
from contextlib import AbstractContextManager
from typing import ParamSpec

_P = ParamSpec("_P")

class Context:
LAYER_NAMES: list[str]
FAIL_ON_CLEANUP_ERRORS: bool
Comment thread
hoel-bagard marked this conversation as resolved.
Outdated

feature: Incomplete
scenario: Incomplete
tags: set[str]
aborted: bool
failed: bool
table: Incomplete
text: str | None
config: Incomplete
active_outline: Incomplete
Comment thread
hoel-bagard marked this conversation as resolved.
Outdated

def __init__(self, runner) -> None: ...
def __getattr__(self, name: str) -> Incomplete: ...
def __setattr__(self, name: str, value) -> None: ...
def __delattr__(self, name: str) -> None: ...
def __contains__(self, name: str) -> bool: ...
def abort(self, reason: str | None = None) -> None: ...
def use_or_assign_param(self, name: str, value): ...
def use_or_create_param(self, name: str, factory_func: Callable[_P, Incomplete], *args: _P.args, **kwargs: _P.kwargs): ...
def use_with_user_mode(self) -> AbstractContextManager[None]: ...
def execute_steps(self, steps_text: str) -> bool: ...
def add_cleanup(self, cleanup_func: Callable[_P, Incomplete], *args: _P.args, **kwargs: _P.kwargs) -> None: ...
@property
def captured(self): ...
def attach(self, mime_type: str, data: bytes) -> None: ...
Comment thread
hoel-bagard marked this conversation as resolved.
17 changes: 17 additions & 0 deletions stubs/behave/behave/step_registry.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from collections.abc import Callable
from typing import Any, Concatenate, TypeVar

from behave.runner import Context

_F = TypeVar("_F", bound=Callable[Concatenate[Context, ...], None])

def given(step_text: str, **kwargs: Any) -> Callable[[_F], _F]: ...
def when(step_text: str, **kwargs: Any) -> Callable[[_F], _F]: ...
def then(step_text: str, **kwargs: Any) -> Callable[[_F], _F]: ...
def step(step_text: str, **kwargs: Any) -> Callable[[_F], _F]: ...
Comment thread
hoel-bagard marked this conversation as resolved.
Outdated

# Title-case aliases
Given = given
When = when
Then = then
Step = step
Comment thread
hoel-bagard marked this conversation as resolved.
Loading