From 5cc5f80202c0a9a8d91ac67cc42bec0764f33d6f Mon Sep 17 00:00:00 2001 From: Anderson Bravalheri Date: Mon, 7 Oct 2024 16:05:02 +0100 Subject: [PATCH] Ignore some lines for coverage --- setuptools/_shutil.py | 6 +++--- setuptools/command/egg_info.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/setuptools/_shutil.py b/setuptools/_shutil.py index 2db65abb630..11379efb684 100644 --- a/setuptools/_shutil.py +++ b/setuptools/_shutil.py @@ -11,7 +11,7 @@ try: from os import chmod # pyright: ignore[reportAssignmentType] # Losing type-safety w/ pyright, but that's ok -except ImportError: +except ImportError: # pragma: no cover # Jython compatibility def chmod(*args: object, **kwargs: object) -> None: # type: ignore[misc] # Mypy reuses the imported definition anyway pass @@ -24,7 +24,7 @@ def attempt_chmod_verbose(path, mode): log.debug("changing mode of %s to %o", path, mode) try: chmod(path, mode) - except OSError as e: + except OSError as e: # pragma: no cover log.debug("chmod failed: %s", e) @@ -32,7 +32,7 @@ def attempt_chmod_verbose(path, mode): def _auto_chmod(func: Callable[..., _T], arg: str, exc: BaseException) -> _T: """shutils onexc callback to automatically call chmod for certain functions.""" # Only retry for scenarios known to have an issue - if func in [os.unlink, os.remove] and os.name == 'nt': + if func in [os.unlink, os.remove] and os.name == 'nt': # pragma: no cover attempt_chmod_verbose(arg, stat.S_IWRITE) return func(arg) raise exc diff --git a/setuptools/command/egg_info.py b/setuptools/command/egg_info.py index f217cba097b..b94cfc75a67 100644 --- a/setuptools/command/egg_info.py +++ b/setuptools/command/egg_info.py @@ -311,7 +311,7 @@ def run(self): # Get rid of native_libs.txt if it was put there by older bdist_egg nl = os.path.join(staging, "native_libs.txt") - if os.path.exists(nl): + if os.path.exists(nl): # pragma: no cover self.delete_file(nl) # Remove old directory and create the new one