diff --git a/tests/test_backup.py b/tests/test_backup.py
index f44dda19c645445c428af6cc3d91197d2d54e728..8c57428af06e7b541cb8734a8d4261b7fdce43fe 100755
--- a/tests/test_backup.py
+++ b/tests/test_backup.py
@@ -85,13 +85,14 @@ def check_backup_is_incremental(path):
 
     for d in dirs:
         num_folders = 0
-        if os.path.isdir(os.path.join(path, d)):
+        folder_path = os.path.join(path, d)
+        if os.path.isdir(folder_path):
             media = glob.glob(os.path.join(path, d, "*/msinstance/media/resources/"))
             for m in media:
                 num_folders += len(os.listdir(m))
             print('%s: %s' % (d, num_folders))
             if num_folders == 0:
-                print('Folder %s is empty, this indicates non-incremental backups (we are expecting links)' % d)
+                print('Folder %s is empty, this indicates non-incremental backups (we are expecting links)' % folder_path)
                 return False
     return True