Resolve the test's home before comparing paths to it

A Mac keeps temporary directories under /var, which is a symlink to
/private/var, and target() resolves what it is handed because a bundle
reached through a symlink is still that bundle. So the login item named
/private/var/... while the test held /var/..., and the two spellings of
one path did not match.
This commit is contained in:
2026-08-16 15:09:40 +03:00
parent 7e510f8b35
commit 01c91eb425
+5 -1
View File
@@ -54,7 +54,11 @@ class Home(unittest.TestCase):
def setUp(self): def setUp(self):
self.tmp = tempfile.TemporaryDirectory() self.tmp = tempfile.TemporaryDirectory()
self.home = pathlib.Path(self.tmp.name) # Resolved, because target() resolves what it is handed and a Mac's
# temporary directory is under /var, which is a symlink to /private/var.
# Left alone, every path here would be compared against the other
# spelling of itself.
self.home = pathlib.Path(self.tmp.name).resolve()
self.addCleanup(self.tmp.cleanup) self.addCleanup(self.tmp.cleanup)
self.applications = self.home / ".local/share/applications" self.applications = self.home / ".local/share/applications"
self.autostart = self.home / ".config/autostart" self.autostart = self.home / ".config/autostart"