From 2d5eaa31c2a39914076f899a1a6930af0d6a9a44 Mon Sep 17 00:00:00 2001
From: Amandine PERRIN <amandine.perrin@pasteur.fr>
Date: Mon, 12 Oct 2020 12:29:47 +0200
Subject: [PATCH] check that genepath is empty if it still exists

---
 .../test_annotate/test_annotation_functions-prodigal.py     | 6 +++++-
 .../test_annotate/test_annotation_functions-prokka.py       | 6 +++++-
 test/test_unit/test_annotate/test_annotation_general.py     | 6 +++++-
 3 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/test/test_unit/test_annotate/test_annotation_functions-prodigal.py b/test/test_unit/test_annotate/test_annotation_functions-prodigal.py
index 1bc41c40..5efd57fc 100644
--- a/test/test_unit/test_annotate/test_annotation_functions-prodigal.py
+++ b/test/test_unit/test_annotate/test_annotation_functions-prodigal.py
@@ -39,7 +39,11 @@ def setup_teardown_module():
     - remove all log files
     - remove directory with generated results
     """
-    if not os.path.exists(GENEPATH):
+    if os.path.isdir(GENEPATH):
+        content = os.listdir(GENEPATH)
+        for f in content:
+            assert f.startswith(".fuse")
+    else:
         os.mkdir(GENEPATH)
     print("setup")
 
diff --git a/test/test_unit/test_annotate/test_annotation_functions-prokka.py b/test/test_unit/test_annotate/test_annotation_functions-prokka.py
index 375ff941..5195543b 100644
--- a/test/test_unit/test_annotate/test_annotation_functions-prokka.py
+++ b/test/test_unit/test_annotate/test_annotation_functions-prokka.py
@@ -40,7 +40,11 @@ def setup_teardown_module():
     - remove all log files
     - remove directory with generated results
     """
-    if not os.path.exists(GENEPATH):
+    if os.path.isdir(GENEPATH):
+        content = os.listdir(GENEPATH)
+        for f in content:
+            assert f.startswith(".fuse")
+    else:
         os.mkdir(GENEPATH)
     print("setup")
 
diff --git a/test/test_unit/test_annotate/test_annotation_general.py b/test/test_unit/test_annotate/test_annotation_general.py
index 02244e95..9fc56129 100644
--- a/test/test_unit/test_annotate/test_annotation_general.py
+++ b/test/test_unit/test_annotate/test_annotation_general.py
@@ -37,7 +37,11 @@ def setup_teardown_module():
     - remove all log files
     - remove directory with generated results
     """
-    if not os.path.exists(GENEPATH):
+    if os.path.isdir(GENEPATH):
+        content = os.listdir(GENEPATH)
+        for f in content:
+            assert f.startswith(".fuse")
+    else:
         os.mkdir(GENEPATH)
     print("setup")
 
-- 
GitLab