Revert "Do not clone the same repository multiple times, re-use already cloned repository"

This reverts commit 330ba9b9c4.

As of RHELCMP-8874, revert this patch as a quick fix.

Signed-off-by: Haibo Lin <hlin@redhat.com>
This commit is contained in:
Haibo Lin 2022-04-13 16:19:26 +08:00
parent e490764985
commit c5cdd498ac
2 changed files with 17 additions and 75 deletions

View file

@ -16,17 +16,14 @@ import six
from pungi.wrappers import scm
from tests.helpers import touch
from kobo.shortcuts import run
from pungi.compose import Compose
class SCMBaseTest(unittest.TestCase):
def setUp(self):
self.destdir = tempfile.mkdtemp()
self.tmp_dir = tempfile.mkdtemp()
def tearDown(self):
shutil.rmtree(self.destdir)
shutil.rmtree(self.tmp_dir)
def assertStructure(self, returned, expected):
# Check we returned the correct files
@ -146,8 +143,7 @@ class GitSCMTestCase(SCMBaseTest):
@mock.patch("pungi.wrappers.scm.run")
def test_get_file_function(self, run):
with mock.patch("pungi.compose.ComposeInfo"):
compose = Compose({}, self.tmp_dir)
compose = mock.Mock(conf={})
def process(cmd, workdir=None, **kwargs):
touch(os.path.join(workdir, "some_file.txt"))
@ -342,8 +338,6 @@ class GitSCMTestCaseReal(SCMBaseTest):
shutil.rmtree(self.gitRepositoryLocation)
def test_get_file_function(self):
with mock.patch("pungi.compose.ComposeInfo"):
compose = Compose({}, self.tmp_dir)
sourceFileLocation = random.choice(list(self.files.keys()))
sourceFilename = os.path.basename(sourceFileLocation)
destinationFileLocation = os.path.join(self.destdir, "other_file.txt")
@ -354,7 +348,7 @@ class GitSCMTestCaseReal(SCMBaseTest):
"file": sourceFilename,
},
os.path.join(self.destdir, destinationFileLocation),
compose=compose,
compose=self.compose,
)
self.assertEqual(destinationFileActualLocation, destinationFileLocation)
self.assertTrue(os.path.isfile(destinationFileActualLocation))
@ -367,8 +361,6 @@ class GitSCMTestCaseReal(SCMBaseTest):
self.assertEqual(sourceFileContent, destinationFileContent)
def test_get_file_function_with_overwrite(self):
with mock.patch("pungi.compose.ComposeInfo"):
compose = Compose({}, self.tmp_dir)
sourceFileLocation = random.choice(list(self.files.keys()))
sourceFilename = os.path.basename(sourceFileLocation)
destinationFileLocation = os.path.join(self.destdir, "other_file.txt")
@ -383,7 +375,7 @@ class GitSCMTestCaseReal(SCMBaseTest):
"file": sourceFilename,
},
os.path.join(self.destdir, destinationFileLocation),
compose=compose,
compose=self.compose,
overwrite=True,
)
self.assertEqual(destinationFileActualLocation, destinationFileLocation)
@ -611,8 +603,7 @@ class KojiSCMTestCase(SCMBaseTest):
@mock.patch("pungi.wrappers.scm.KojiWrapper")
def test_doesnt_get_dirs(self, KW, dl):
with mock.patch("pungi.compose.ComposeInfo"):
compose = Compose({"koji_profile": "koji"}, self.tmp_dir)
compose = mock.Mock(conf={"koji_profile": "koji"})
with self.assertRaises(RuntimeError) as ctx:
scm.get_dir_from_scm(
@ -637,8 +628,7 @@ class KojiSCMTestCase(SCMBaseTest):
@mock.patch("pungi.wrappers.scm.KojiWrapper")
def test_get_from_build(self, KW, dl):
with mock.patch("pungi.compose.ComposeInfo"):
compose = Compose({"koji_profile": "koji"}, self.tmp_dir)
compose = mock.Mock(conf={"koji_profile": "koji"})
def download(src, dst):
touch(dst)
@ -669,8 +659,7 @@ class KojiSCMTestCase(SCMBaseTest):
@mock.patch("pungi.wrappers.scm.KojiWrapper")
def test_get_from_latest_build(self, KW, dl):
with mock.patch("pungi.compose.ComposeInfo"):
compose = Compose({"koji_profile": "koji"}, self.tmp_dir)
compose = mock.Mock(conf={"koji_profile": "koji"})
def download(src, dst):
touch(dst)