From 06a0dae67f7497075e6da1b0e51d4fcab2c679c6 Mon Sep 17 00:00:00 2001 From: Brad Warren Date: Tue, 23 Jul 2019 11:01:29 -0700 Subject: [PATCH] Fix test_symlink_resolution on macOS. (#7263) This fixes the test failures which can be seen at https://travis-ci.com/certbot/certbot/builds/120123338. The problem here is the path returned by tempfile.mkdtemp() contains a symlink. For instance, one run of the function produced '/var/folders/3b/zg8fdh5j71x92yyzc1tyllfw0000gp/T/tmp3k9ytfj1' which is a symlink to '/private/var/folders/3b/zg8fdh5j71x92yyzc1tyllfw0000gp/T/tmp3k9ytfj1'. Removing this symlink before testing filesystem.realpath solves the problem. You can see the macOS tests passing with this change at https://travis-ci.com/certbot/certbot/builds/120250667. --- certbot/tests/compat/filesystem_test.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/certbot/tests/compat/filesystem_test.py b/certbot/tests/compat/filesystem_test.py index 5d112b652..48ac04670 100644 --- a/certbot/tests/compat/filesystem_test.py +++ b/certbot/tests/compat/filesystem_test.py @@ -329,6 +329,8 @@ class RealpathTest(test_util.TempDirTestCase): self.probe_path = _create_probe(self.tempdir) def test_symlink_resolution(self): + # Remove any symlinks already in probe_path + self.probe_path = filesystem.realpath(self.probe_path) # Absolute resolution link_path = os.path.join(self.tempdir, 'link_abs') os.symlink(self.probe_path, link_path)