nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
fork

Configure Feed

Select the types of activity you want to include in your feed.

at master 58 lines 1.9 kB view raw
1# This file contains type hints that can be prepended to Nix test scripts so they can be type 2# checked. 3 4from test_driver.debug import DebugAbstract 5from test_driver.driver import Driver 6from test_driver.vlan import VLan 7from test_driver.machine import BaseMachine, NspawnMachine, QemuMachine 8from test_driver.logger import AbstractLogger 9from typing import Callable, Iterator, ContextManager, Optional, List, Dict, Any, Union 10from typing_extensions import Protocol 11from pathlib import Path 12from unittest import TestCase 13 14 15class RetryProtocol(Protocol): 16 def __call__(self, fn: Callable, timeout_seconds: int = 900) -> None: 17 raise Exception("This is just type information for the Nix test driver") 18 19 20class PollingConditionProtocol(Protocol): 21 def __call__( 22 self, 23 fun_: Optional[Callable] = None, 24 *, 25 seconds_interval: float = 2.0, 26 description: Optional[str] = None, 27 ) -> Union[Callable[[Callable], ContextManager], ContextManager]: 28 raise Exception("This is just type information for the Nix test driver") 29 30 31class CreateMachineProtocol(Protocol): 32 def __call__( 33 self, 34 start_command: str | dict, 35 *, 36 name: Optional[str] = None, 37 keep_machine_state: bool = False, 38 **kwargs: Any, # to allow usage of deprecated keep_vm_state 39 ) -> BaseMachine: 40 raise Exception("This is just type information for the Nix test driver") 41 42 43start_all: Callable[[], None] 44subtest: Callable[[str], ContextManager[None]] 45retry: RetryProtocol 46test_script: Callable[[], None] 47machines: List[BaseMachine] 48vlans: List[VLan] 49driver: Driver 50log: AbstractLogger 51create_machine: CreateMachineProtocol 52run_tests: Callable[[], None] 53join_all: Callable[[], None] 54serial_stdout_off: Callable[[], None] 55serial_stdout_on: Callable[[], None] 56polling_condition: PollingConditionProtocol 57debug: DebugAbstract 58t: TestCase