-
-
Notifications
You must be signed in to change notification settings - Fork 2k
[behave]: add some common decorators #15505
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
b12f371
behave: add given, when, then, step, use_fixture, fixture and Context
hoel-bagard a47c17a
mark as partial stub
hoel-bagard d121d19
add dunder methods
hoel-bagard b400040
stubtest: ignore missing stub
hoel-bagard 33ea86a
fix: parameter name
hoel-bagard 7c2b277
fix: use Incomplete instead of Any
hoel-bagard 9994610
add behave to the exclude list in pyrightconfig.stricter.json
hoel-bagard a31fef0
fix: add missing __getattr__
hoel-bagard 8860735
Apply suggestions from code review (__getattr__, ClassVar)
hoel-bagard File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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: ... | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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: ... | ||
hoel-bagard marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| def __getattr__(name: str) -> Incomplete: ... | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
hoel-bagard marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| def __getattr__(name: str) -> Incomplete: ... | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.