Skip to content
Snippets Groups Projects
Commit f9346dc1 authored by Simon McVittie's avatar Simon McVittie
Browse files

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: default avatarSimon McVittie <smcv@collabora.com>
parent a246f537
No related branches found
No related tags found
1 merge request!63tests: Reassure mypy that an Optional[str] cannot be None
Pipeline #15136 passed
...@@ -123,7 +123,7 @@ class TestPressureVessel(unittest.TestCase): ...@@ -123,7 +123,7 @@ class TestPressureVessel(unittest.TestCase):
if os.access(ldlp, os.W_OK): if os.access(ldlp, os.W_OK):
self.ld_library_path_runtime = ldlp = os.path.abspath(ldlp) self.ld_library_path_runtime = ldlp = os.path.abspath(ldlp)
else: else:
old = self.ld_library_path_runtime old = ldlp
ldlp = os.path.join(self.tmpdir.name, 'ldlp') ldlp = os.path.join(self.tmpdir.name, 'ldlp')
shutil.copytree(old, ldlp, symlinks=True) shutil.copytree(old, ldlp, symlinks=True)
self.ld_library_path_runtime = ldlp self.ld_library_path_runtime = ldlp
...@@ -136,10 +136,7 @@ class TestPressureVessel(unittest.TestCase): ...@@ -136,10 +136,7 @@ class TestPressureVessel(unittest.TestCase):
old = self.scout_layered old = self.scout_layered
new = os.path.join(self.tmpdir.name, 'scout-on-soldier') new = os.path.join(self.tmpdir.name, 'scout-on-soldier')
shutil.copytree(old, new, symlinks=True) shutil.copytree(old, new, symlinks=True)
os.symlink( os.symlink(ldlp, os.path.join(new, 'steam-runtime'))
self.ld_library_path_runtime,
os.path.join(new, 'steam-runtime'),
)
self.scout_layered = new self.scout_layered = new
else: else:
self.scout_layered = '' self.scout_layered = ''
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment