Fork me on GitHub
#cursive
<
2017-07-08
>
cfleming07:07:25

@goomba No, it’s not, sorry.

cfleming07:07:01

Still have to use Evaluate Expression, which is a little clunky but has the advantage of allowing the result to be explored.

Lone Ranger16:07:20

indeed thank you!

onetom22:07:02

is there anyone here using tolitius/mount or aroemers/mount-lite with cursive? im trying the with-session feature of mount-lite (https://github.com/aroemers/mount-lite/blob/2.x/src/mount/lite.clj#L207-L218) which creates a separate thread.

onetom22:07:04

i thought i would just wrap my tests using with-session inside an :each fixture:

(defn with-test-db [tests]
  (-> (mount/with-session
        (mount/with-substitutes
          [#'conn (test-conn)]
          (mount/start))
        (tests))
      :result deref))

(use-fixtures :each with-test-db)

(deftest test-inside-session-using-fixtures
  (tx! [{:db/id "e" :str "asd"}])
  (is (= {:str "asd"}
         (q '[:find (pull ?e [:str]) .
              :where [?e :str "asd"]]))))
https://gitlab.com/onetom/mount-lite-example/blob/master/test/app/pretty_db_test.clj#L7-21

onetom22:07:26

but as a result i was surprised with some cursive test integration internals when i Run tests in current NS in REPL:

Loading test/app/pretty_db_test.clj... done
Running tests in app.pretty-db-test

Testing app.pretty-db-test

===>>> Setting up test DB <<<===

@#Cursive#TestSupport#@ {:file "pretty_db_test.clj", :line 21, :class "app.pretty_db_test$fn__4511", :type :pass, :expected "(= {:str \"asd\"} (q (quote [:find (pull ?e [:str]) . :where [?e :str \"asd\"]])))", :message nil}
===>>> Tearing down test DB <<<===

Ran 0 tests containing 0 assertions.
0 failures, 0 errors.

onetom22:07:43

sometimes i get the test summary way ahead of time:

Loading test/app/pretty_db_test.clj... done
Running tests in app.pretty-db-test

Testing app.pretty-db-test

Ran 0 tests containing 0 assertions.
0 failures, 0 errors.

===>>> Setting up test DB <<<===

@#Cursive#TestSupport#@ {:file "pretty_db_test.clj", :line 19, :class "app.pretty_db_test$fn__5225", :type :fail, :expected "(= {:str \"asd\"} (q (quote [:find (pull ?e [:str]) . :where [?e :str \"asd\"]])))", :actual "(not (= {:str \"asd\"} nil))", :message nil}
===>>> Tearing down test DB <<<===

onetom22:07:16

so im clearly not synchronising with the clojure.test framework somehow... i was thinking maybe i should pass down clojure.core/{*out*,*err*} to the thread so it can communicate back to cursive but seeing the test summary so early kinda invalidates this idea