tests: Fix tests for old version of git

GitSCMTestCaseReal failed with error 'Unknown option: -C' when building
rpm for el7.

Signed-off-by: Haibo Lin <hlin@redhat.com>
This commit is contained in:
Haibo Lin 2020-08-18 09:24:00 +08:00
parent 29761d1656
commit 1e1c8533ac
2 changed files with 12 additions and 6 deletions

View File

@ -931,7 +931,7 @@ class TestAddScratchModuleToVariant(helpers.PungiTestCase):
variant.arch_mmds, {"x86_64": {self.nsvc: mock_mmd.return_value}} variant.arch_mmds, {"x86_64": {self.nsvc: mock_mmd.return_value}}
) )
self.assertEqual( self.assertEqual(
tag_to_mmd, {"scratch-module-tag": {"x86_64": {mock_mmd.return_value}}} tag_to_mmd, {"scratch-module-tag": {"x86_64": set([mock_mmd.return_value])}}
) )
self.assertEqual(variant.modules, []) self.assertEqual(variant.modules, [])

View File

@ -285,8 +285,14 @@ class GitSCMTestCaseReal(SCMBaseTest):
super(GitSCMTestCaseReal, self).setUp() super(GitSCMTestCaseReal, self).setUp()
self.compose = mock.Mock(conf={}) self.compose = mock.Mock(conf={})
self.gitRepositoryLocation = tempfile.mkdtemp() self.gitRepositoryLocation = tempfile.mkdtemp()
git_dir = os.path.join(self.gitRepositoryLocation, ".git")
run( run(
["git", "-C", self.gitRepositoryLocation, "init"], [
"git",
"--git-dir=%s" % git_dir,
"--work-tree=%s" % self.gitRepositoryLocation,
"init",
],
workdir=self.gitRepositoryLocation, workdir=self.gitRepositoryLocation,
) )
fileOneLocation = os.path.join(self.gitRepositoryLocation, "some_file.txt") fileOneLocation = os.path.join(self.gitRepositoryLocation, "some_file.txt")
@ -301,8 +307,8 @@ class GitSCMTestCaseReal(SCMBaseTest):
run( run(
[ [
"git", "git",
"-C", "--git-dir=%s" % git_dir,
self.gitRepositoryLocation, "--work-tree=%s" % self.gitRepositoryLocation,
"add", "add",
"some_file.txt", "some_file.txt",
"other_file.txt", "other_file.txt",
@ -317,8 +323,8 @@ class GitSCMTestCaseReal(SCMBaseTest):
"user.name=Pungi Test Engineer", "user.name=Pungi Test Engineer",
"-c", "-c",
"user.email=ptestengineer@example.com", "user.email=ptestengineer@example.com",
"-C", "--git-dir=%s" % git_dir,
self.gitRepositoryLocation, "--work-tree=%s" % self.gitRepositoryLocation,
"commit", "commit",
"-m", "-m",
"Initial commit", "Initial commit",