Skip to content

Commit

Permalink
metrics: fix metrics recursive hook
Browse files Browse the repository at this point in the history
  • Loading branch information
uael committed Jul 27, 2023
1 parent 755417a commit 94357d0
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions avatar/metrics/trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ def next_id() -> int:

def hook_test(test: BaseTestClass, devices: PandoraDevices) -> None:
global packets
original_teardown_class = test.__class__.teardown_class
original_setup_test = test.__class__.setup_test
original_teardown_class = test.teardown_class
original_setup_test = test.setup_test

def teardown_class(self: BaseTestClass) -> None:
output_path: str = test.current_test_info.output_path # type: ignore
Expand All @@ -65,7 +65,7 @@ def teardown_class(self: BaseTestClass) -> None:
f.write(f"{packet}")
f.write("----------\n")

original_teardown_class(self)
original_teardown_class()

def setup_test(self: BaseTestClass) -> None:
global genesis
Expand All @@ -92,10 +92,10 @@ def setup_test(self: BaseTestClass) -> None:
)
packets.append(TracePacket(track_descriptor=descriptor))

original_setup_test(self)
original_setup_test()

test.__class__.teardown_class = types.MethodType(teardown_class, test)
test.__class__.setup_test = types.MethodType(setup_test, test)
test.teardown_class = types.MethodType(teardown_class, test)
test.setup_test = types.MethodType(setup_test, test)


class AsTrace(Protocol):
Expand Down

0 comments on commit 94357d0

Please sign in to comment.