Skip to content

Commit

Permalink
Ignore some lines for coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
abravalheri committed Oct 7, 2024
1 parent 8421e5d commit 5cc5f80
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions setuptools/_shutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -24,15 +24,15 @@ 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:
"""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
Expand Down
2 changes: 1 addition & 1 deletion setuptools/command/egg_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5cc5f80

Please sign in to comment.