From 2a8316b1c7440f7239cd74470b26bad6a50f9a2c Mon Sep 17 00:00:00 2001 From: John Mulligan Date: Wed, 22 Feb 2023 13:57:21 -0500 Subject: [PATCH] cephadm: disable coverage for some compatibility blocks This change disables reporting missing coverage for blocks that contain copy and pasted code from other python versions and exist to make those functions available to older python versions. Signed-off-by: John Mulligan --- src/cephadm/cephadm.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/cephadm/cephadm.py b/src/cephadm/cephadm.py index b3d0c1621db55..cc925d3ee23a0 100755 --- a/src/cephadm/cephadm.py +++ b/src/cephadm/cephadm.py @@ -1700,7 +1700,9 @@ class CallVerbosity(Enum): return _verbosity_level_to_log_level[self] # type: ignore -if sys.version_info < (3, 8): +# disable coverage for the next block. this is copy-n-paste +# from other code for compatibilty on older python versions +if sys.version_info < (3, 8): # pragma: no cover import itertools import threading import warnings @@ -1805,7 +1807,9 @@ if sys.version_info < (3, 8): try: from asyncio import run as async_run # type: ignore[attr-defined] -except ImportError: +except ImportError: # pragma: no cover + # disable coverage for this block. it should be a copy-n-paste from + # from newer libs for compatibilty on older python versions def async_run(coro): # type: ignore loop = asyncio.new_event_loop() try: -- 2.39.5