I'm using clojure.test (with expectations). I have a certain namespace full of tests, which none of them run. Are there any reasons a certain test namespace would just inexplicably not run any tests?
user> (run-tests 'todefer.routes-test)
Testing todefer.routes-test
Ran 0 tests containing 0 assertions.
0 failures, 0 errors.
{:test 0, :pass 0, :fail 0, :error 0, :type :summary}namespace is loaded ofc
hm I commented out one of the fixtures and now it runs the tests (though they fail ofc)
I guess if a fixture fails it just behaves as-if there are no tests?
What is your fixture code?
(I would expect to see some sort of visible failure if the fixture itself failed)
fixture just this:
(defn logged-in-fixture []
(swap! session-atom assoc "testsession1" {:user "foo"}))oh this fixture is wrongly defined.
Right, a fixture should take a single argument and invoke it as part of its work (assuming a traditional fixture, rather than the before/after style that cljs offers -- and expectations also supports). Still, I'd expect to see an arity error exception in that case when the testing library tried to invoke the fixture...
hm
Yeah, I get an exception:
(ns exploring.fixtures-test
(:require [clojure.test :refer :all]
[exploring.fixtures :refer :all]))
(defn bad-fixture [] (println "I should not run!"))
(use-fixtures :each bad-fixture)
(deftest a-test
(testing "FIXME, I fail."
(is (= 0 1))))
produces:
Testing exploring.fixtures-test
; Execution error (ArityException) at clojure.test/compose-fixtures$fn$fn (test.clj:694).
; Wrong number of args (1) passed to: exploring.fixtures-test/bad-fixture
which is what I would expect.(and I switched that to expectations.clojure.test and still got the exception -- so I'm curious as to how you weren't getting that?)
Hm there was defo no error. I'll try it again later and see.