Skip to content

Commit

Permalink
Minor improvements to BaseBench (#18)
Browse files Browse the repository at this point in the history
* Fixing issue with the `BaseBench.parameter` decorator not respecting
default values when no parameter override is provided;
 * Returning instance from `BaseBench.register` for convenience.
  • Loading branch information
Intuity committed Apr 16, 2024
1 parent 30e2d44 commit a7c17fc
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions forastero/bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ def register(
scoreboard: bool = True,
scoreboard_verbose: bool = False,
scoreboard_queues: list[str] | None = None,
) -> None:
) -> Component | Coroutine:
"""
Register a driver, monitor, or coroutine with the testbench. Drivers and
monitors must be provided a name and their random seeding will be setup
Expand Down Expand Up @@ -238,6 +238,7 @@ def register(
)
else:
raise TypeError(f"Unsupported object: {comp_or_coro}")
return comp_or_coro

def schedule(self, sequence: BaseSequence, blocking: bool = True) -> Task:
"""
Expand Down Expand Up @@ -399,9 +400,10 @@ async def _run_test():
await comp.ready()

# Are there any parameters for this test?
params = {
x: cls.get_parameter(x) for x in cls.TEST_REQ_PARAMS[self._func]
}
params = {}
for key in cls.TEST_REQ_PARAMS[self._func]:
if (value := cls.get_parameter(key)) is not None:
params[key] = value

# Create a forked log
log = tb.fork_log("testcase", self._func.__name__)
Expand Down

0 comments on commit a7c17fc

Please sign in to comment.