From 54376cff3dd30efd8b966ab548050da90cc0b286 Mon Sep 17 00:00:00 2001
From: Xavier Robin <xavalias-github@xavier.robin.name>
Date: Thu, 23 Nov 2023 08:49:53 +0100
Subject: [PATCH] test: remove compound lib only after tests are complete

This fixes test_complib.py on mac
---
 modules/conop/tests/test_complib.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/modules/conop/tests/test_complib.py b/modules/conop/tests/test_complib.py
index 275fd1459..9de009afd 100644
--- a/modules/conop/tests/test_complib.py
+++ b/modules/conop/tests/test_complib.py
@@ -14,13 +14,16 @@ class TestCompLib(unittest.TestCase):
         chemdict_tool_path = os.path.join(prefix_path, "bin", "chemdict_tool")
         if not os.path.exists(chemdict_tool_path):
             raise RuntimeError("Expect chemdict_tool:", chemdict_tool_path)
-        tmp_dir = tempfile.TemporaryDirectory()
+        cls.tmp_dir = tempfile.TemporaryDirectory()
         compounds_path = os.path.join("testfiles", "test_compounds.cif")
-        complib_path = os.path.join(tmp_dir.name, "test_complib.dat")
+        complib_path = os.path.join(cls.tmp_dir.name, "test_complib.dat")
         cmd = [chemdict_tool_path, "create", compounds_path, complib_path]
         subprocess.run(cmd)
         cls.complib = conop.CompoundLib.Load(complib_path)
-        tmp_dir.cleanup()
+
+    @classmethod
+    def tearDownClass(cls):
+        cls.tmp_dir.cleanup()
 
     def test_three_vs_five_letter_code(self):
         complib = self.complib
-- 
GitLab