Coverage for tests / decorator_test / disable_timer.py: 90%

10 statements  

« prev     ^ index     » next       coverage.py v7.13.5, created at 2026-04-28 08:31 +0000

1"""Methods used to test that the appropriate envvar disables the timing 

2decorator. 

3""" 

4 

5import logging 

6import time 

7 

8from lsst.utils.timer import timeMethod 

9 

10log = logging.getLogger("disable_timer") 

11 

12 

13@timeMethod(logger=log, logLevel=logging.INFO) 

14def sleep_and_log(self, duration: float) -> None: 

15 """Check that this does not log if the decorator was disabled on import.""" 

16 time.sleep(duration) 

17 

18 

19@timeMethod 

20def sleep_and_nothing(self, duration: float) -> None: 

21 """Check that this does not have a `__wrapped__` attribute to confirm that 

22 the decorator is disabled. 

23 """ 

24 time.sleep(duration)