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
This commit is contained in:
Pierre Riteau 2021-01-20 12:56:24 +01:00
parent e96bd3309a
commit e0120b43ed

View File

@ -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))