Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Extracted part of the open-global-connections-fixture into separated …

…functions to open/close global test connection for reuse in the REPL.
  • Loading branch information...
commit 655739ec7ac28d81fdcf85b2e2812efbab5e8c61 1 parent fbe08be
Nicolas Buduroi budu authored
Showing with 13 additions and 7 deletions.
  1. +13 −7 test/lobos/test.clj
20 test/lobos/test.clj
View
@@ -113,6 +113,17 @@
(defmacro inspect-schema [& keys]
`(-> (analyze-schema *db* :lobos) ~@keys))
+(defn open-global-connections []
+ (doseq [db-spec available-specs]
+ (try
+ (open-global (test-db-name db-spec) db-spec)
+ (catch Exception _
+ (println "WARNING: Failed to connect to" (:subprotocol db-spec))))))
+
+(defn close-global-connections []
+ (doseq [db (available-global-cnx)]
+ (close-global db)))
+
;;;; Fixtures
(def tmp-files-ext '(db sqlite3))
@@ -135,11 +146,6 @@
(println (format "WARNING: Driver for %s isn't available: %s missing"
(:subprotocol db-spec)
(:classname db-spec)))))
- (doseq [db-spec available-specs]
- (try
- (open-global (test-db-name db-spec) db-spec)
- (catch Exception _
- (println "WARNING: Failed to connect to" (:subprotocol db-spec)))))
+ (open-global-connections)
(f)
- (doseq [db (available-global-cnx)]
- (close-global db)))
+ (close-global-connections))
Please sign in to comment.
Something went wrong with that request. Please try again.