summaryrefslogtreecommitdiff
path: root/tests/test_subcmds_sync.py
diff options
context:
space:
mode:
authorDaniel Kutik <daniel.kutik@lavawerk.com>2023-08-15 15:59:07 +0200
committerLUCI <gerrit-scoped@luci-project-accounts.iam.gserviceaccount.com>2023-09-13 18:24:04 +0000
commit880c621dc641e3b27233199f6cd3a9438fdf73ab (patch)
treea51ef770d6d1a0b6c03892ac2cc37e434d9c23ba /tests/test_subcmds_sync.py
parentda6ae1da8b057220d6b14d684e35a7b08068c935 (diff)
downloadgit-repo-880c621dc641e3b27233199f6cd3a9438fdf73ab.tar.gz
git-repo-880c621dc641e3b27233199f6cd3a9438fdf73ab.zip
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>
Diffstat (limited to 'tests/test_subcmds_sync.py')
-rw-r--r--tests/test_subcmds_sync.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/tests/test_subcmds_sync.py b/tests/test_subcmds_sync.py
index b9f0a7467..71e404898 100644
--- a/tests/test_subcmds_sync.py
+++ b/tests/test_subcmds_sync.py
@@ -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):