mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-01-14 04:50:20 -06:00
better no-cover for windows
This commit is contained in:
@@ -41,14 +41,14 @@ try: # pragma: no cover (windows)
|
||||
# "Regions should be locked only briefly and should be unlocked
|
||||
# before closing a file or exiting the program."
|
||||
msvcrt.locking(fileno, msvcrt.LK_UNLCK, _region)
|
||||
except ImportError: # pragma: no cover (posix)
|
||||
except ImportError: # pragma: windows no cover
|
||||
import fcntl
|
||||
|
||||
@contextlib.contextmanager
|
||||
def _locked(fileno, blocked_cb):
|
||||
try:
|
||||
fcntl.flock(fileno, fcntl.LOCK_EX | fcntl.LOCK_NB)
|
||||
except IOError:
|
||||
except IOError: # pragma: no cover (tests are single-threaded)
|
||||
blocked_cb()
|
||||
fcntl.flock(fileno, fcntl.LOCK_EX)
|
||||
try:
|
||||
|
||||
@@ -28,7 +28,7 @@ def get_env_patch(venv):
|
||||
install_prefix = r'{}\bin'.format(win_venv.strip())
|
||||
elif sys.platform == 'win32': # pragma: no cover
|
||||
install_prefix = bin_dir(venv)
|
||||
else:
|
||||
else: # pragma: windows no cover
|
||||
install_prefix = venv
|
||||
return (
|
||||
('NODE_VIRTUAL_ENV', venv),
|
||||
|
||||
Reference in New Issue
Block a user