Skip to content

Commit

Permalink
using last_expected_time (instead of first) for the Performance_Measu…
Browse files Browse the repository at this point in the history
…re_Session calculations in GH Actions)
  • Loading branch information
DinisCruz committed Jan 20, 2025
1 parent 857788b commit 612d29f
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ def assert_time(self, *expected_time: int):
if self.assert_enabled is False:
return
if in_github_action():
first_expected_time = expected_time[0] + 100 # +100 in case it is 0
new_expected_time = first_expected_time * 5
assert first_expected_time <= self.result.final_score <= new_expected_time, f"Performance changed for {self.result.name}: expected {first_expected_time} < {self.result.final_score:,d}ns, expected {new_expected_time}"
last_expected_time = expected_time[-1] + 100 # +100 in case it is 0
new_expected_time = last_expected_time * 5 # using last_expected_time * 5 as the upper limit (since these tests are significantly slowed in GitHUb Actions)
assert last_expected_time <= self.result.final_score <= new_expected_time, f"Performance changed for {self.result.name}: expected {last_expected_time} < {self.result.final_score:,d}ns, expected {new_expected_time}"
else:
assert self.result.final_score in expected_time, f"Performance changed for {self.result.name}: got {self.result.final_score:,d}ns, expected {expected_time}"
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# from unittest import TestCase
# from osbot_utils.helpers.trace.Trace_Call import trace_calls
# from osbot_utils.type_safe.Type_Safe import Type_Safe
#
# class test__perf__Type_Safe__tracing(TestCase):
from typing import Optional, List, Dict, Union
from unittest import TestCase
from osbot_utils.helpers.trace.Trace_Call import trace_calls
from osbot_utils.type_safe.Type_Safe import Type_Safe

class test__perf__Type_Safe__tracing(TestCase):
#
# @trace_calls(include=['*'], show_internals=True, show_lines=True, show_types=True, show_class=True,
# show_duration=True, duration_padding=150)
Expand All @@ -26,4 +27,36 @@
# class An_Class(Type_Safe):
# an_str:str
#
# An_Class()
# An_Class()


@trace_calls(include = ['*' ],
ignore = ['typing' ],
show_internals = False ,
show_lines = False ,
show_types = False ,
show_class = True ,
show_duration = True ,
duration_padding = 120 )
def test_complex_types(self):

class ComplexTypes(Type_Safe): # Multiple complex types
optional_str : Optional [str]
str_list : List [str]
int_dict : Dict [str, int]
union_field : Union [str, int]

ComplexTypes()













0 comments on commit 612d29f

Please sign in to comment.