[neon/backports-focal/xdg-desktop-portal/Neon/unstable] tests: document-portal: Fix key error in the tests

Alexander Larsson null at kde.org
Wed Jan 13 06:32:42 GMT 2021


Git commit 96c2df2ec665e65f85bda859138624b88fd992a0 by Alexander Larsson.
Committed on 02/04/2020 at 15:01.
Pushed by ash into branch 'Neon/unstable'.

document-portal: Fix key error in the tests

Only remove the file if its in the list

M  +3    -2    tests/test-document-fuse.py

https://invent.kde.org/neon/backports-focal/xdg-desktop-portal/commit/96c2df2ec665e65f85bda859138624b88fd992a0

diff --git a/tests/test-document-fuse.py b/tests/test-document-fuse.py
index 7fd79c4..511693c 100644
--- a/tests/test-document-fuse.py
+++ b/tests/test-document-fuse.py
@@ -170,9 +170,10 @@ def assertDirFiles(path, expected_files, exhaustive = True, volatile_files = Non
     found_files = os.listdir (path)
     remaining = set(found_files)
     for file in expected_files:
-        if not file in remaining and not file in volatile_files:
+        if file in remaining:
+            remaining.remove(file)
+        elif not file in volatile_files:
             raise AssertionError("Expected file {} not found in dir {} (all: {})".format(file, path, found_files))
-        remaining.remove(file)
     if exhaustive:
         if len(remaining) != 0:
             raise AssertionError("Unexpected files {} in dir {} (all: {})".format(remaining, path, found_files))



More information about the Neon-commits mailing list