mirror of
https://gerrit.googlesource.com/git-repo
synced 2024-12-21 07:16:21 +00:00
test: fix path seperator errors on windows
Fixing multiple errors when running tests on Windows related to path seperator being different ('\' instead of '/'). Signed-off-by: Daniel Kutik <daniel.kutik@lavawerk.com> Change-Id: I26b44d092b925edecab46a4d88e77dd9dcb8df28 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/353178 Reviewed-by: Mike Frysinger <vapier@google.com>
This commit is contained in:
parent
7b3afcab7a
commit
0297f8312c
@ -42,21 +42,21 @@ class GitCommandTest(unittest.TestCase):
|
|||||||
|
|
||||||
def test_alternative_setting_when_matching(self):
|
def test_alternative_setting_when_matching(self):
|
||||||
r = git_command._build_env(
|
r = git_command._build_env(
|
||||||
objdir = 'zap/objects',
|
objdir = os.path.join('zap', 'objects'),
|
||||||
gitdir = 'zap'
|
gitdir = 'zap'
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertIsNone(r.get('GIT_ALTERNATE_OBJECT_DIRECTORIES'))
|
self.assertIsNone(r.get('GIT_ALTERNATE_OBJECT_DIRECTORIES'))
|
||||||
self.assertEqual(r.get('GIT_OBJECT_DIRECTORY'), 'zap/objects')
|
self.assertEqual(r.get('GIT_OBJECT_DIRECTORY'), os.path.join('zap', 'objects'))
|
||||||
|
|
||||||
def test_alternative_setting_when_different(self):
|
def test_alternative_setting_when_different(self):
|
||||||
r = git_command._build_env(
|
r = git_command._build_env(
|
||||||
objdir = 'wow/objects',
|
objdir = os.path.join('wow', 'objects'),
|
||||||
gitdir = 'zap'
|
gitdir = 'zap'
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertEqual(r.get('GIT_ALTERNATE_OBJECT_DIRECTORIES'), 'zap/objects')
|
self.assertEqual(r.get('GIT_ALTERNATE_OBJECT_DIRECTORIES'), os.path.join('zap', 'objects'))
|
||||||
self.assertEqual(r.get('GIT_OBJECT_DIRECTORY'), 'wow/objects')
|
self.assertEqual(r.get('GIT_OBJECT_DIRECTORY'), os.path.join('wow', 'objects'))
|
||||||
|
|
||||||
|
|
||||||
class GitCallUnitTest(unittest.TestCase):
|
class GitCallUnitTest(unittest.TestCase):
|
||||||
|
@ -519,22 +519,22 @@ class ProjectElementTests(ManifestParseTestCase):
|
|||||||
""")
|
""")
|
||||||
|
|
||||||
manifest = parse('a/path/', 'foo')
|
manifest = parse('a/path/', 'foo')
|
||||||
self.assertEqual(manifest.projects[0].gitdir,
|
self.assertEqual(os.path.normpath(manifest.projects[0].gitdir),
|
||||||
os.path.join(self.tempdir, '.repo/projects/foo.git'))
|
os.path.join(self.tempdir, '.repo', 'projects', 'foo.git'))
|
||||||
self.assertEqual(manifest.projects[0].objdir,
|
self.assertEqual(os.path.normpath(manifest.projects[0].objdir),
|
||||||
os.path.join(self.tempdir, '.repo/project-objects/a/path.git'))
|
os.path.join(self.tempdir, '.repo', 'project-objects', 'a', 'path.git'))
|
||||||
|
|
||||||
manifest = parse('a/path', 'foo/')
|
manifest = parse('a/path', 'foo/')
|
||||||
self.assertEqual(manifest.projects[0].gitdir,
|
self.assertEqual(os.path.normpath(manifest.projects[0].gitdir),
|
||||||
os.path.join(self.tempdir, '.repo/projects/foo.git'))
|
os.path.join(self.tempdir, '.repo', 'projects', 'foo.git'))
|
||||||
self.assertEqual(manifest.projects[0].objdir,
|
self.assertEqual(os.path.normpath(manifest.projects[0].objdir),
|
||||||
os.path.join(self.tempdir, '.repo/project-objects/a/path.git'))
|
os.path.join(self.tempdir, '.repo', 'project-objects', 'a', 'path.git'))
|
||||||
|
|
||||||
manifest = parse('a/path', 'foo//////')
|
manifest = parse('a/path', 'foo//////')
|
||||||
self.assertEqual(manifest.projects[0].gitdir,
|
self.assertEqual(os.path.normpath(manifest.projects[0].gitdir),
|
||||||
os.path.join(self.tempdir, '.repo/projects/foo.git'))
|
os.path.join(self.tempdir, '.repo', 'projects', 'foo.git'))
|
||||||
self.assertEqual(manifest.projects[0].objdir,
|
self.assertEqual(os.path.normpath(manifest.projects[0].objdir),
|
||||||
os.path.join(self.tempdir, '.repo/project-objects/a/path.git'))
|
os.path.join(self.tempdir, '.repo', 'project-objects', 'a', 'path.git'))
|
||||||
|
|
||||||
def test_toplevel_path(self):
|
def test_toplevel_path(self):
|
||||||
"""Check handling of path=. specially."""
|
"""Check handling of path=. specially."""
|
||||||
@ -551,8 +551,8 @@ class ProjectElementTests(ManifestParseTestCase):
|
|||||||
|
|
||||||
for path in ('.', './', './/', './//'):
|
for path in ('.', './', './/', './//'):
|
||||||
manifest = parse('server/path', path)
|
manifest = parse('server/path', path)
|
||||||
self.assertEqual(manifest.projects[0].gitdir,
|
self.assertEqual(os.path.normpath(manifest.projects[0].gitdir),
|
||||||
os.path.join(self.tempdir, '.repo/projects/..git'))
|
os.path.join(self.tempdir, '.repo', 'projects', '..git'))
|
||||||
|
|
||||||
def test_bad_path_name_checks(self):
|
def test_bad_path_name_checks(self):
|
||||||
"""Check handling of bad path & name attributes."""
|
"""Check handling of bad path & name attributes."""
|
||||||
|
@ -384,7 +384,7 @@ class MigrateWorkTreeTests(unittest.TestCase):
|
|||||||
|
|
||||||
# Make sure the dir was transformed into a symlink.
|
# Make sure the dir was transformed into a symlink.
|
||||||
self.assertTrue(dotgit.is_symlink())
|
self.assertTrue(dotgit.is_symlink())
|
||||||
self.assertEqual(os.readlink(dotgit), '../../.repo/projects/src/test.git')
|
self.assertEqual(os.readlink(dotgit), os.path.normpath('../../.repo/projects/src/test.git'))
|
||||||
|
|
||||||
# Make sure files were moved over.
|
# Make sure files were moved over.
|
||||||
gitdir = tempdir / '.repo/projects/src/test.git'
|
gitdir = tempdir / '.repo/projects/src/test.git'
|
||||||
|
Loading…
Reference in New Issue
Block a user