From 1e1c8533acc8340dd2d1daca920a7e5d4edcb87e Mon Sep 17 00:00:00 2001 From: Haibo Lin Date: Tue, 18 Aug 2020 09:24:00 +0800 Subject: [PATCH] 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 --- tests/test_pkgset_source_koji.py | 2 +- tests/test_scm.py | 16 +++++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/tests/test_pkgset_source_koji.py b/tests/test_pkgset_source_koji.py index 26f9d914..c4f85d39 100644 --- a/tests/test_pkgset_source_koji.py +++ b/tests/test_pkgset_source_koji.py @@ -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, []) diff --git a/tests/test_scm.py b/tests/test_scm.py index b97ce4ec..1cb7f35f 100644 --- a/tests/test_scm.py +++ b/tests/test_scm.py @@ -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",