Windows symlink: wrap tempfile.mkdtemp() to long path func

This commit is contained in:
Dmitry Petrov
2017-04-10 12:20:06 -07:00
parent f628c28d3d
commit f539fa8c60
5 changed files with 12 additions and 7 deletions
+4 -2
View File
@@ -54,9 +54,8 @@ class GitWrapperI(object):
LONG_PATH_BUFFER_SIZE = 1024
@staticmethod
def get_cwd():
def get_long_path(path):
"""Convert short path to a full path. It is needed for Windows."""
path = os.getcwd()
if os.name != 'nt':
return path
@@ -67,6 +66,9 @@ class GitWrapperI(object):
return path
return buffer.value
@staticmethod
def get_cwd():
return GitWrapperI.get_long_path(os.getcwd())
@staticmethod
def parse_porcelain_files(out):
+3 -1
View File
@@ -11,7 +11,9 @@ from dvc.utils import rmtree
class BasicEnvironment(TestCase):
def init_environment(self, test_dir=tempfile.mkdtemp(), curr_dir=None):
def init_environment(self,
test_dir=GitWrapperI.get_long_path(tempfile.mkdtemp()),
curr_dir=None):
self._test_dir = os.path.realpath(test_dir)
self._proj_dir = 'proj'
self._test_git_dir = os.path.join(self._test_dir, self._proj_dir)
+2 -2
View File
@@ -7,14 +7,14 @@ from dvc.config import ConfigI
from dvc.executor import Executor
from dvc.path.data_item import DataItem
from dvc.path.factory import PathFactory
from dvc.git_wrapper import GitWrapper
from dvc.git_wrapper import GitWrapper, GitWrapperI
from dvc.settings import Settings
from dvc.utils import rmtree
class RunBasicTest(TestCase):
def setUp(self):
self.test_dir = tempfile.mkdtemp()
self.test_dir = GitWrapperI.get_long_path(tempfile.mkdtemp())
self._old_curr_dir_abs = os.path.realpath(os.curdir)
self.tearDown()
+2 -1
View File
@@ -5,11 +5,12 @@ from unittest import TestCase
from dvc import Runtime
from dvc.executor import Executor, ExecutorError
from dvc.git_wrapper import GitWrapperI
class TestExecutor(TestCase):
def setUp(self):
self.test_dir = tempfile.mkdtemp()
self.test_dir = GitWrapperI.get_long_path(tempfile.mkdtemp())
self.file1 = 'file1.txt'
fd1 = open(os.path.join(self.test_dir, self.file1), 'w+')
+1 -1
View File
@@ -13,7 +13,7 @@ from dvc.settings import Settings
class BasicTestRepositoryChange(TestCase):
def setUp(self):
self.test_dir = tempfile.mkdtemp()
self.test_dir = GitWrapperI.get_long_path(tempfile.mkdtemp())
self._old_curr_dir_abs = os.path.realpath(os.curdir)
self.tearDown()