mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
path: local: str return full path on value error
This commit is contained in:
@@ -97,3 +97,36 @@ def ssh(ssh_server):
|
||||
port=ssh_server.port,
|
||||
key_filename=key_path,
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def temporary_windows_drive(repo_dir):
|
||||
import string
|
||||
import win32api
|
||||
from ctypes import windll
|
||||
from win32con import DDD_REMOVE_DEFINITION
|
||||
|
||||
drives = [
|
||||
s[0].upper()
|
||||
for s in win32api.GetLogicalDriveStrings().split("\000")
|
||||
if len(s) > 0
|
||||
]
|
||||
|
||||
new_drive_name = [
|
||||
letter for letter in string.ascii_uppercase if letter not in drives
|
||||
][0]
|
||||
new_drive = "{}:".format(new_drive_name)
|
||||
|
||||
target_path = repo_dir.mkdtemp()
|
||||
|
||||
set_up_result = windll.kernel32.DefineDosDeviceW(0, new_drive, target_path)
|
||||
if set_up_result == 0:
|
||||
raise RuntimeError("Failed to mount windows drive!")
|
||||
|
||||
yield new_drive
|
||||
|
||||
tear_down_result = windll.kernel32.DefineDosDeviceW(
|
||||
DDD_REMOVE_DEFINITION, new_drive, target_path
|
||||
)
|
||||
if tear_down_result == 0:
|
||||
raise RuntimeError("Could not unmount windows drive!")
|
||||
|
||||
Reference in New Issue
Block a user