diff --git a/stubs/behave/behave/runner.pyi b/stubs/behave/behave/runner.pyi index a3abfa2d0de2..a557fdd94a59 100644 --- a/stubs/behave/behave/runner.pyi +++ b/stubs/behave/behave/runner.pyi @@ -1,9 +1,17 @@ from _typeshed import Incomplete from collections.abc import Callable from contextlib import AbstractContextManager -from typing import ClassVar, ParamSpec +from enum import Enum +from typing import Any, ClassVar, ParamSpec, TypeVar _P = ParamSpec("_P") +_T = TypeVar("_T") + +class ContextMaskWarning(UserWarning): ... + +class ContextMode(Enum): + BEHAVE = 1 + USER = 2 class Context: LAYER_NAMES: ClassVar[list[str]] @@ -20,13 +28,13 @@ class Context: active_outline: Incomplete fail_on_cleanup_errors: bool - def __init__(self, runner) -> None: ... + def __init__(self, runner: Incomplete) -> 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_assign_param(self, name: str, value: _T) -> _T | None: ... 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: ... @@ -35,4 +43,56 @@ class Context: def captured(self): ... def attach(self, mime_type: str, data: bytes) -> None: ... +class ModelRunner: + config: Incomplete + features: Incomplete + hooks: Incomplete + formatters: Incomplete + step_registry: Incomplete + capture_controller: Incomplete + capture_sink: Incomplete + context: Incomplete + feature: Incomplete + hook_failures: int + def __init__( + self, config: Incomplete, features: list[Incomplete] | None = None, step_registry: Incomplete | None = None + ) -> None: ... + @property + def undefined_steps(self) -> list[Incomplete]: ... + + @property + def aborted(self) -> bool: ... + @aborted.setter + def aborted(self, value) -> None: ... + + def abort(self, reason: str | None = None) -> None: ... + def should_run_hook(self, hook_name: str) -> bool: ... + def run_hook(self, hook_name: str, *args: Any) -> None: ... + def should_capture_hook(self, hook_name: str) -> bool: ... + def run_hook_with_capture(self, hook_name: str, *args: str, **kwargs: str) -> bool: ... + def run_hook_tags(self, hook_name: str, tags: list[str]) -> bool: ... + def run_hook_tags_with_capture(self, hook_name: str, tags: list[str], capture_sink: Incomplete | None = None) -> bool: ... + def setup_capture(self, name: str | None = None) -> None: ... + def start_capture(self) -> None: ... + def stop_capture(self) -> None: ... + def teardown_capture(self) -> None: ... + @property + def captured(self) -> Incomplete: ... + def run_model(self, features: list[Incomplete] | None = None) -> bool: ... + def run(self) -> bool: ... + +class Runner(ModelRunner): + DEFAULT_DIRECTORY: str + path_manager: Incomplete + base_dir: Incomplete + + def __init__(self, config: Incomplete) -> None: ... + def setup_paths(self) -> None: ... + def before_all_default_hook(self, context: Context) -> None: ... + def load_hooks(self, filename: str | None = None) -> None: ... + def load_step_definitions(self, extra_step_paths: list[str] | None = None) -> None: ... + def feature_locations(self) -> list[str]: ... + def run(self) -> bool: ... + def run_with_paths(self) -> bool: ... + def __getattr__(name: str) -> Incomplete: ...