From f9346dc194ab9520ce9b4e1782fe9d91513fa1ac Mon Sep 17 00:00:00 2001
From: Simon McVittie <smcv@collabora.com>
Date: Mon, 5 Jul 2021 14:49:19 +0100
Subject: [PATCH] tests: Reassure mypy that an Optional[str] cannot be None

After we have checked `ldlp is not None`, mypy can safely assume that it
is indeed not None, but the same is not true for an attribute like
`self.ld_library_path_runtime`, which could in principle be computed
dynamically (even though in this case it isn't).

Signed-off-by: Simon McVittie <smcv@collabora.com>
---
 tests/depot/pressure-vessel.py | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/tests/depot/pressure-vessel.py b/tests/depot/pressure-vessel.py
index 0533fdf..f54ac3a 100755
--- a/tests/depot/pressure-vessel.py
+++ b/tests/depot/pressure-vessel.py
@@ -123,7 +123,7 @@ class TestPressureVessel(unittest.TestCase):
             if os.access(ldlp, os.W_OK):
                 self.ld_library_path_runtime = ldlp = os.path.abspath(ldlp)
             else:
-                old = self.ld_library_path_runtime
+                old = ldlp
                 ldlp = os.path.join(self.tmpdir.name, 'ldlp')
                 shutil.copytree(old, ldlp, symlinks=True)
                 self.ld_library_path_runtime = ldlp
@@ -136,10 +136,7 @@ class TestPressureVessel(unittest.TestCase):
             old = self.scout_layered
             new = os.path.join(self.tmpdir.name, 'scout-on-soldier')
             shutil.copytree(old, new, symlinks=True)
-            os.symlink(
-                self.ld_library_path_runtime,
-                os.path.join(new, 'steam-runtime'),
-            )
+            os.symlink(ldlp, os.path.join(new, 'steam-runtime'))
             self.scout_layered = new
         else:
             self.scout_layered = ''
-- 
GitLab