Skip to content

Commit

Permalink
Remove setup_class and teardown_class
Browse files Browse the repository at this point in the history
  • Loading branch information
finngl committed Nov 22, 2023
1 parent fd26c66 commit 1afee39
Showing 1 changed file with 7 additions and 15 deletions.
22 changes: 7 additions & 15 deletions tests/test_simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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)

Expand Down

0 comments on commit 1afee39

Please sign in to comment.