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}}
)
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, [])

View File

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