mirror of
https://gerrit.googlesource.com/git-repo
synced 2024-12-21 07:16:21 +00:00
tests: test_subcmds_sync.py: fix for py3.6 & 3.7
tests/test_subcmds_sync.py::LocalSyncState::test_prune_removed_projects was failing in Python 3.6 and 3.7 due to topdir not being set with the following error message: TypeError: expected str, bytes or os.PathLike object, not MagicMock topdir is accessed from within PruneRemovedProjects(). Test: tox with Python 3.6 to 3.11 Change-Id: I7ba5144df0a0126c01776384e2178136c3510091 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/382816 Reviewed-by: Mike Frysinger <vapier@google.com> Commit-Queue: Daniel Kutik <daniel.kutik@lavawerk.com> Tested-by: Daniel Kutik <daniel.kutik@lavawerk.com>
This commit is contained in:
parent
da6ae1da8b
commit
880c621dc6
@ -117,8 +117,12 @@ class LocalSyncState(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
"""Common setup."""
|
||||
self.repodir = tempfile.mkdtemp(".repo")
|
||||
self.topdir = tempfile.mkdtemp("LocalSyncState")
|
||||
self.repodir = os.path.join(self.topdir, ".repo")
|
||||
os.makedirs(self.repodir)
|
||||
|
||||
self.manifest = mock.MagicMock(
|
||||
topdir=self.topdir,
|
||||
repodir=self.repodir,
|
||||
repoProject=mock.MagicMock(relpath=".repo/repo"),
|
||||
)
|
||||
@ -126,7 +130,7 @@ class LocalSyncState(unittest.TestCase):
|
||||
|
||||
def tearDown(self):
|
||||
"""Common teardown."""
|
||||
shutil.rmtree(self.repodir)
|
||||
shutil.rmtree(self.topdir)
|
||||
|
||||
def _new_state(self, time=_TIME):
|
||||
with mock.patch("time.time", return_value=time):
|
||||
|
Loading…
Reference in New Issue
Block a user