Fix test when run with tempdir on different windows drive.
Jelmer Vernooij
8 months ago
448 | 448 | repo_dir = os.path.join(os.path.dirname(__file__), 'data', 'repos') |
449 | 449 | shutil.copytree(os.path.join(repo_dir, 'a.git'), |
450 | 450 | os.path.join(temp_dir, 'a.git'), symlinks=True) |
451 | rel = os.path.relpath(os.path.join(repo_dir, 'submodule'), temp_dir) | |
451 | try: | |
452 | rel = os.path.relpath( | |
453 | os.path.join(repo_dir, 'submodule'), temp_dir) | |
454 | except ValueError: | |
455 | # On windows, these two paths could be on different drives, | |
456 | # making it impossible to determine a relative path. | |
457 | rel = os.path.join(repo_dir, 'submodule') | |
452 | 458 | os.symlink(os.path.join(rel, 'dotgit'), os.path.join(temp_dir, '.git')) |
453 | 459 | with Repo(temp_dir) as r: |
454 | 460 | self.assertEqual(r.head(), |