From 1afee39928fdfed5523016628d1d23cf3d204d18 Mon Sep 17 00:00:00 2001 From: Finn Gruwier Larsen Date: Wed, 22 Nov 2023 12:38:53 +0100 Subject: [PATCH] Remove setup_class and teardown_class --- tests/test_simple.py | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/tests/test_simple.py b/tests/test_simple.py index 2b9b75b..f22efcc 100755 --- a/tests/test_simple.py +++ b/tests/test_simple.py @@ -45,21 +45,6 @@ class TestBifrostchewBBACA: ] bson_entries = [database_interface.json_to_bson(i) for i in sample_template] - @classmethod - def setup_class(cls): - with pymongo.MongoClient(os.environ["BIFROST_DB_KEY"]) as client: - db = client.get_database() - cls.clear_all_collections(db) - col = db["samples"] - col.insert_many(cls.bson_entries) - os.chdir(cls.bifrost_install_dir) - - # @classmethod - # def teardown_class(cls): - # with pymongo.MongoClient(os.environ["BIFROST_DB_KEY"]) as client: - # db = client.get_database() - # cls.clear_all_collections(db) - @staticmethod def clear_all_collections(db): db.drop_collection("components") @@ -76,6 +61,13 @@ def test_help(self): launcher.run_pipeline(["--help"]) def test_pipeline(self): + with pymongo.MongoClient(os.environ["BIFROST_DB_KEY"]) as client: + db = client.get_database() + self.clear_all_collections(db) + col = db["samples"] + col.insert_many(self.bson_entries) + os.chdir(self.bifrost_install_dir) + if os.path.isdir(self.test_dir): shutil.rmtree(self.test_dir)