Fixtures
provide.testkit.chaos.fixtures
¶
Pytest fixtures for chaos testing.
Provides reusable fixtures that enable chaos injection and control in property-based tests.
Classes¶
ChaosFailureInjector
¶
Injectable failure patterns for chaos testing.
Allows tests to inject failures at specific points.
Initialize failure injector.
Source code in provide/testkit/chaos/fixtures.py
Functions¶
check
¶
Check if failure should be injected at this call.
Raises:
| Type | Description |
|---|---|
Exception
|
If a failure is scheduled for this call number |
Source code in provide/testkit/chaos/fixtures.py
reset
¶
ChaosTimeSource
¶
Controllable time source for chaos testing.
Allows tests to manipulate time for testing time-dependent behavior.
Initialize chaos time source.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
start_time
|
float | None
|
Initial time value (defaults to current time) |
None
|
Source code in provide/testkit/chaos/fixtures.py
Functions¶
advance
¶
Advance time by specified seconds.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
seconds
|
float
|
Time to advance (can be negative for backwards jumps) |
required |
freeze
¶
reset
¶
Functions¶
chaos_config
¶
Provide chaos testing configuration.
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Dictionary with chaos configuration options |
Example
Source code in provide/testkit/chaos/fixtures.py
chaos_failure_injector
¶
Provide a failure injector for chaos testing.
Yields:
| Type | Description |
|---|---|
ChaosFailureInjector
|
ChaosFailureInjector instance |
Example
Source code in provide/testkit/chaos/fixtures.py
chaos_time_source
¶
Provide a controllable time source for chaos testing.
Yields:
| Type | Description |
|---|---|
ChaosTimeSource
|
ChaosTimeSource instance for time manipulation |
Example
Source code in provide/testkit/chaos/fixtures.py
chaos_time_source_factory
¶
Create a time source function for components that need callable time sources.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
initial_time
|
float | None
|
Initial time value |
None
|
Returns:
| Type | Description |
|---|---|
Callable[[], float]
|
Callable that returns time |
Example
Source code in provide/testkit/chaos/fixtures.py
hypothesis_chaos_settings
¶
Apply Hypothesis settings optimized for chaos testing.
Configures Hypothesis for thorough chaos exploration.