Pre: Use SQLite temp files in deftest-db.
These temp files will almost certainly live in memory only, speeding our test suite evaluation significantly. Before this patch, in a warmed REPL environment I get: Testing datomish.db-test Ran 19 tests containing 97 assertions. 0 failures, 0 errors. "Elapsed time: 1408.720681 msecs" "Elapsed time: 1343.986464 msecs" "Elapsed time: 1338.660762 msecs" After this patch, in a warmed REPL environment I get: Testing datomish.db-test Ran 19 tests containing 97 assertions. 0 failures, 0 errors. "Elapsed time: 587.605168 msecs" "Elapsed time: 569.522333 msecs" "Elapsed time: 589.080282 msecs"
This commit is contained in:
parent
cfdce12c1a
commit
94bac9704b
1 changed files with 6 additions and 15 deletions
|
@ -5,8 +5,7 @@
|
|||
(ns datomish.test-macros
|
||||
#?(:cljs
|
||||
(:require-macros
|
||||
[datomish.test-macros]
|
||||
[datomish.node-tempfile-macros]))
|
||||
[datomish.test-macros]))
|
||||
(:require
|
||||
[datomish.pair-chan]))
|
||||
|
||||
|
@ -44,16 +43,8 @@
|
|||
(defmacro deftest-db
|
||||
[n conn-var & body]
|
||||
`(deftest-async ~n
|
||||
(if-cljs
|
||||
(datomish.node-tempfile-macros/with-tempfile [t# (datomish.node-tempfile/tempfile)]
|
||||
(let [~conn-var (datomish.pair-chan/<? (datomish.api/<connect t#))]
|
||||
(let [~conn-var (datomish.pair-chan/<? (datomish.api/<connect ""))]
|
||||
(try
|
||||
~@body
|
||||
(finally
|
||||
(datomish.pair-chan/<? (datomish.api/<close ~conn-var))))))
|
||||
(tempfile.core/with-tempfile [t# (tempfile.core/tempfile)]
|
||||
(let [~conn-var (datomish.pair-chan/<? (datomish.api/<connect t#))]
|
||||
(try
|
||||
~@body
|
||||
(finally
|
||||
(datomish.pair-chan/<? (datomish.api/<close ~conn-var)))))))))
|
||||
(datomish.pair-chan/<? (datomish.api/<close ~conn-var)))))))
|
||||
|
|
Loading…
Reference in a new issue