X-Git-Url: https://wannabe.guru.org/gitweb/?a=blobdiff_plain;f=unittest_utils.py;h=b9746a80307ad512cee993aca29449e365e998b6;hb=e70297b7e29a07457d6c7195425e734a1290abeb;hp=f4fed35f09fdf29970820bef8566652825327634;hpb=e6f32fdd9b373dfcd100c7accb41f57d83c2f0a1;p=python_utils.git diff --git a/unittest_utils.py b/unittest_utils.py index f4fed35..b9746a8 100644 --- a/unittest_utils.py +++ b/unittest_utils.py @@ -158,6 +158,9 @@ def check_method_for_perf_regressions(func: Callable) -> Callable: @functools.wraps(func) def wrapper_perf_monitor(*args, **kwargs): + if config.config['unittests_ignore_perf']: + return func(*args, **kwargs) + if config.config['unittests_persistance_strategy'] == 'FILE': filename = config.config['unittests_perfdb_filename'] helper = FileBasedPerfRegressionDataPersister(filename) @@ -208,7 +211,7 @@ def check_method_for_perf_regressions(func: Callable) -> Callable: limit = slowest + stdev * 4 logger.debug(f'For {func_name}, max acceptable runtime is {limit:f}s') logger.debug(f'For {func_name}, actual observed runtime was {run_time:f}s') - if run_time > limit and not config.config['unittests_ignore_perf']: + if run_time > limit: msg = f'''{func_id} performance has regressed unacceptably. {slowest:f}s is the slowest runtime on record in {len(hist)} perf samples. It just ran in {run_time:f}s which is 4+ stdevs slower than the slowest. @@ -275,6 +278,7 @@ class RecordStdout(object): ... print("This is a test!") >>> print({record().readline()}) {'This is a test!\\n'} + >>> record().close() """ def __init__(self) -> None: @@ -301,6 +305,7 @@ class RecordStderr(object): ... print("This is a test!", file=sys.stderr) >>> print({record().readline()}) {'This is a test!\\n'} + >>> record().close() """ def __init__(self) -> None: