Skip to content

Commit ed11953

Browse files
authored
[behave] Add package (incomplete) (#15505)
1 parent 4449b2b commit ed11953

File tree

6 files changed

+93
-0
lines changed

6 files changed

+93
-0
lines changed

pyrightconfig.stricter.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"stubs/auth0-python",
2727
"stubs/Authlib",
2828
"stubs/aws-xray-sdk",
29+
"stubs/behave",
2930
"stubs/boltons",
3031
"stubs/braintree",
3132
"stubs/cffi",

stubs/behave/METADATA.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
version = "1.3.*"
2+
upstream_repository = "https://github.com/behave/behave"
3+
partial_stub = true
4+
5+
[tool.stubtest]
6+
ignore_missing_stub = true

stubs/behave/behave/__init__.pyi

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
from behave.fixture import fixture as fixture, use_fixture as use_fixture
2+
from behave.step_registry import (
3+
Given as Given,
4+
Step as Step,
5+
Then as Then,
6+
When as When,
7+
given as given,
8+
step as step,
9+
then as then,
10+
when as when,
11+
)
12+
13+
__all__ = ["given", "when", "then", "step", "Given", "When", "Then", "Step", "use_fixture", "fixture"]

stubs/behave/behave/fixture.pyi

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
from _typeshed import Incomplete
2+
from collections.abc import Callable
3+
from typing import Any, Concatenate, ParamSpec, TypeVar
4+
5+
from behave.runner import Context
6+
7+
_T = TypeVar("_T")
8+
_F = TypeVar("_F", bound=Callable[..., Any])
9+
_P = ParamSpec("_P")
10+
11+
def use_fixture(
12+
fixture_func: Callable[Concatenate[Context, _P], _T], context: Context, *fixture_args: _P.args, **fixture_kwargs: _P.kwargs
13+
) -> _T: ...
14+
def fixture(func: _F | None = None, name: str | None = None, pattern: str | None = None) -> _F: ...
15+
def __getattr__(name: str) -> Incomplete: ...

stubs/behave/behave/runner.pyi

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
from _typeshed import Incomplete
2+
from collections.abc import Callable
3+
from contextlib import AbstractContextManager
4+
from typing import ClassVar, ParamSpec
5+
6+
_P = ParamSpec("_P")
7+
8+
class Context:
9+
LAYER_NAMES: ClassVar[list[str]]
10+
FAIL_ON_CLEANUP_ERRORS: ClassVar[bool]
11+
12+
feature: Incomplete | None
13+
scenario: Incomplete
14+
tags: set[str]
15+
aborted: bool
16+
failed: bool
17+
table: Incomplete | None
18+
text: str | None
19+
config: Incomplete
20+
active_outline: Incomplete
21+
fail_on_cleanup_errors: bool
22+
23+
def __init__(self, runner) -> None: ...
24+
def __getattr__(self, name: str) -> Incomplete: ...
25+
def __setattr__(self, name: str, value) -> None: ...
26+
def __delattr__(self, name: str) -> None: ...
27+
def __contains__(self, name: str) -> bool: ...
28+
def abort(self, reason: str | None = None) -> None: ...
29+
def use_or_assign_param(self, name: str, value): ...
30+
def use_or_create_param(self, name: str, factory_func: Callable[_P, Incomplete], *args: _P.args, **kwargs: _P.kwargs): ...
31+
def use_with_user_mode(self) -> AbstractContextManager[None]: ...
32+
def execute_steps(self, steps_text: str) -> bool: ...
33+
def add_cleanup(self, cleanup_func: Callable[_P, Incomplete], *args: _P.args, **kwargs: _P.kwargs) -> None: ...
34+
@property
35+
def captured(self): ...
36+
def attach(self, mime_type: str, data: bytes) -> None: ...
37+
38+
def __getattr__(name: str) -> Incomplete: ...
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
from _typeshed import Incomplete
2+
from collections.abc import Callable
3+
from typing import Concatenate, TypeVar
4+
5+
from behave.runner import Context
6+
7+
_F = TypeVar("_F", bound=Callable[Concatenate[Context, ...], None])
8+
9+
def given(step_text: str, **kwargs) -> Callable[[_F], _F]: ...
10+
def when(step_text: str, **kwargs) -> Callable[[_F], _F]: ...
11+
def then(step_text: str, **kwargs) -> Callable[[_F], _F]: ...
12+
def step(step_text: str, **kwargs) -> Callable[[_F], _F]: ...
13+
14+
# Title-case aliases
15+
Given = given
16+
When = when
17+
Then = then
18+
Step = step
19+
20+
def __getattr__(name: str) -> Incomplete: ...

0 commit comments

Comments
 (0)