Blob Blame History Raw
From a6b4effcfb24780d9d2d1b76efa33132381f76eb Mon Sep 17 00:00:00 2001
From: Mattia Rizzolo <mattia@debian.org>
Date: Sun, 1 Jul 2018 20:53:48 +0200
Subject: [PATCH] tempfiles: empty the list of known tempfiles after removing
 them

tempfiles would be cleaned up between tests, so the new "base directory"
would be removed as well, that made the next tentative to create a temporary
directory fail.

This is not interesting for regular execution of diffoscope, as only
programs executing diffoscope.main.main() twice within the same python
process would notice.

Closes: #902709
Signed-off-by: Mattia Rizzolo <mattia@debian.org>
---
 diffoscope/tempfiles.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/diffoscope/tempfiles.py b/diffoscope/tempfiles.py
index 4e4e93f3d9..83357d6d86 100644
--- a/diffoscope/tempfiles.py
+++ b/diffoscope/tempfiles.py
@@ -55,6 +55,7 @@ def clean_all_temp_files():
             pass
         except:
             logger.exception("Unable to delete %s", x)
+    _FILES.clear()
 
     logger.debug("Cleaning %d temporary directories", len(_DIRS))
 
@@ -75,6 +76,7 @@ def clean_all_temp_files():
             pass
         except:
             logger.exception("Unable to delete %s", x)
+    _DIRS.clear()
 
 
 def _get_base_temporary_directory():