fix check for symlink path in unittest
authorPhilipp Gesang <philipp.gesang@intra2net.com>
Mon, 3 Feb 2020 09:09:48 +0000 (10:09 +0100)
committerThomas Jarosch <thomas.jarosch@intra2net.com>
Tue, 4 Feb 2020 13:08:27 +0000 (14:08 +0100)
os.path.exists() will return false in the event that it is passed
a broken symlink which defeats the point of testing whether the
link itself exists. use path.lexist() instead which properly
checks with O_NOFOLLOW.

testing/test_deltatar.py

index adfcfbb..ae5e183 100644 (file)
@@ -1883,7 +1883,7 @@ class DeltaTarTest(BaseTest):
         # retrieve the first item it finds for a given path which in the case
         # at hand is a symlink to some non-existent path
         fullpath = os.path.join("source_dir", testpath)
-        assert not os.path.exists(fullpath)
+        assert not os.path.lexists(fullpath)
 
 
 def fsapi_access_true (self):