Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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"]
15 changes: 15 additions & 0 deletions stubs/behave/behave/fixture.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from _typeshed import Incomplete
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: ...
def __getattr__(name: str) -> Incomplete: ...
38 changes: 38 additions & 0 deletions stubs/behave/behave/runner.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
from _typeshed import Incomplete
from collections.abc import Callable
from contextlib import AbstractContextManager
from typing import ClassVar, ParamSpec

_P = ParamSpec("_P")

class Context:
LAYER_NAMES: ClassVar[list[str]]
FAIL_ON_CLEANUP_ERRORS: ClassVar[bool]

feature: Incomplete | None
scenario: Incomplete
tags: set[str]
aborted: bool
failed: bool
table: Incomplete | None
text: str | None
config: Incomplete
active_outline: Incomplete
fail_on_cleanup_errors: bool

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: ...

def __getattr__(name: str) -> Incomplete: ...
20 changes: 20 additions & 0 deletions stubs/behave/behave/step_registry.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from _typeshed import Incomplete
from collections.abc import Callable
from typing import Concatenate, TypeVar

from behave.runner import Context

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

def given(step_text: str, **kwargs) -> Callable[[_F], _F]: ...
def when(step_text: str, **kwargs) -> Callable[[_F], _F]: ...
def then(step_text: str, **kwargs) -> Callable[[_F], _F]: ...
def step(step_text: str, **kwargs) -> Callable[[_F], _F]: ...

# Title-case aliases
Given = given
When = when
Then = then
Step = step

def __getattr__(name: str) -> Incomplete: ...
Loading