I've got some fixtures that boot up and close the database in my project.
Now it looks something like this:
(use-fixtures :once with-embedded-db)
while in the fixture itself I've got a dynamic variable that I use in different places:
(def ^:dynamic *db*)
(defn with-embedded-db [f]
(binding [*db* (db/connect args)]
(f)
(finally
(db/clean-up *db)))
Now, assume that db/connect
and db/clean-up
take some time.
PROBLEM:
When I run tests using lein test
, it takes very long time, unnecessarily spending time on connecting and disconnecting to the db for every namespace.
QUESTION:
Is there a way to set up global fixtures so that when I run lein test
, it calls it only once for all the test namespaces?
Thanks!
Aucun commentaire:
Enregistrer un commentaire