Skip to content

Commit

Permalink
✨ PoC: flow calling function
Browse files Browse the repository at this point in the history
  • Loading branch information
honzaprevratil committed Dec 16, 2024
1 parent 932dacb commit 8601d25
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions docs/testing-framework/fuzzing.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ Execution hooks are functions that are executed during the `FuzzTest` lifecycle.

- `pre_sequence(self)` - executed before each test sequence,
- `pre_flow(self, flow: Callable)` - executed before each flow, accepts the flow function to be executed as an argument,
- `call_flow(self, flow: Callable, flow_params: List[Any])` - executes each flow, accepts the flow function to be executed as an argument and the flow parameters which will be passed to the flow function,
- `post_flow(self, flow: Callable)` - executed after each flow, accepts the flow function that was executed as an argument,
- `pre_invariants(self)` - executed before each set of invariants,
- `pre_invariant(self, invariant: Callable)` - executed before each invariant, accepts the invariant function to be executed as an argument,
Expand Down
7 changes: 5 additions & 2 deletions wake/testing/fuzzing/fuzz_test.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

from collections import defaultdict
from typing import Callable, DefaultDict, List, Optional
from typing import Callable, DefaultDict, List, Optional, Any

from typing_extensions import get_type_hints

Expand Down Expand Up @@ -121,7 +121,7 @@ def run(

self._flow_num = j
self.pre_flow(flow)
flow(self, *flow_params)
self.call_flow(flow, flow_params)
flows_counter[flow] += 1
self.post_flow(flow)

Expand Down Expand Up @@ -152,6 +152,9 @@ def post_sequence(self) -> None:
def pre_flow(self, flow: Callable) -> None:
pass

def call_flow(self, flow: Callable, flow_params: List[Any]) -> None:
flow(self, *flow_params)

def post_flow(self, flow: Callable) -> None:
pass

Expand Down

0 comments on commit 8601d25

Please sign in to comment.