Closed raystubbs closed 3 years ago
Do you have an example closer to what actually fails due to this?
Yeah, this test fails since the defclass
macro bases class names on the current ns.
I don't think there is any good reason to have this expectation. clojure.test tests can be run from any namespace and often are run from namespaces other than the place where they are defined.
If you want to enforce this constraint, you can do so via a :once fixture:
(defn ns-fixture
[f]
(in-ns 'example.core-test)
(f))
(use-fixtures :once ns-fixture)
Hmm, okay. Seems odd that you can't depend on the namespace; but makes some sense if that's the convention.
Using
clj -X:test
seems to run the tests in theuser
namespace, which breaks tests that rely on*ns*
. Here's a repro.Result: