From e0120b43ed9b4e243fd9efaba3a9b1c33f94a958 Mon Sep 17 00:00:00 2001
From: Pierre Riteau <pierre@stackhpc.com>
Date: Wed, 20 Jan 2021 12:56:24 +0100
Subject: [PATCH] Fix unit tests on macOS

This unit test was failing because /tmp is a symlink to /private/tmp on
macOS. _detect_install_prefix() returns a different path because it
calls os.path.realpath().

Change-Id: I2482c86efebd66a5d22a761df82763cecd764386
---
 kayobe/tests/unit/test_utils.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/kayobe/tests/unit/test_utils.py b/kayobe/tests/unit/test_utils.py
index 79eaafa1..9afe62da 100644
--- a/kayobe/tests/unit/test_utils.py
+++ b/kayobe/tests/unit/test_utils.py
@@ -124,8 +124,9 @@ key2: value2
         self.assertEqual(expected, utils.escape_jinja(value))
 
     def test_detect_install_prefix(self):
-        path = "/tmp/test/local/lib/python3.6/dist-packages"
-        expected = os.path.normpath("/tmp/test/local/")
+        tmp_path = os.path.realpath('/tmp')
+        path = "%s/test/local/lib/python3.6/dist-packages" % tmp_path
+        expected = os.path.normpath("%s/test/local/" % tmp_path)
         result = utils._detect_install_prefix(path)
         self.assertEqual(expected, os.path.normpath(result))
 
-- 
GitLab