From e588f89ffbb3f278dc4e4b816362096c46f294c1 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 | 8 +++++--- setuptools/command/egg_info.py | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/setuptools/_shutil.py b/setuptools/_shutil.py index 2db65abb63..ca6397343c 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,12 +24,14 @@ 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) # Must match shutil._OnExcCallback -def _auto_chmod(func: Callable[..., _T], arg: str, exc: BaseException) -> _T: +def _auto_chmod( + func: Callable[..., _T], arg: str, exc: BaseException +) -> _T: # pragma: no cover """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': diff --git a/setuptools/command/egg_info.py b/setuptools/command/egg_info.py index f217cba097..b94cfc75a6 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