def test_same_drive_with_different_path(self): path1 = os.path.join('x:', 'foo', 'bar.txt') path2 = os.path.join('x:', 'zoo') not_same_drive = os.path.join('y:', 'bb') self.assertTrue(is_same_drive(path1, path2)) self.assertFalse(is_same_drive(path1, not_same_drive)) self.assertFalse(is_same_drive(not_same_drive, path1))
def _relative_path(self, value): src = self._controller.datafile.source if utils.is_same_drive(src, value): path = relpath(value, src if isdir(src) else dirname(src)) else: path = value return path.replace('\\', '/') if IS_WINDOWS else path.replace('\\', '\\\\')
def _get_suite_source_for_command(self): cur = os.path.abspath(os.path.curdir) source = os.path.abspath(self._chief.suite.source) if not utils.is_same_drive(cur, source): return source return os.path.abspath(self._chief.suite.source)
def test_same_drive_is_case_insensitive(self): self.assertTrue(is_same_drive('D:', 'd:')) self.assertFalse(is_same_drive('x:', 'E:'))
def test_same_drive_with_same_path(self): path = os.path.join('a:', 'quu', 'huu.out') self.assertTrue(is_same_drive(path, path))
def _get_suite_source_for_command(self): cur = os.path.abspath(os.path.curdir) source = os.path.abspath(self._project.suite.source) if not utils.is_same_drive(cur, source): return source return os.path.abspath(self._project.suite.source)