ninjudd / cake

A tasty build tool for Clojure.
clojure-cake.org
Eclipse Public License 1.0
171 stars 12 forks source link

Weird issue with running unit/integration tests #91

Closed budu closed 12 years ago

budu commented 13 years ago

I've come across an inexplicable issue while running unit and integration tests together. If there's a unit test namespace being ran after an integration test namespace using the same namespace as the one used by the unit test ns, all tests where assertions use equality fail. Here's the ns call for the integration test:

(ns lobos.test.integration
  (:refer-clojure :exclude [compile drop])
  (:use (lobos schema analyzer compiler core)
        (lobos.backends h2 postgresql)
        :reload)...

and the unit test ns call:

(ns lobos.test.schema
  (:use [lobos.schema] :reload)
  (:use [clojure.test]))

Just touching the unit test file fix the problem, so it must be related to the way it's being loaded. There's no problem running these tests with Leiningen.

lancepantz commented 13 years ago

hey budu, thanks for the bug report, let's see if we can figure it out. first could you tell me the output of cake --version?

budu commented 13 years ago

I've installed it through gem, the version is cake 0.5.8

budu commented 13 years ago

I've just pushed my latest commits for the project I was working on when I noticed this issue: https://github.com/budu/lobos

It's easily reproducible: run the tests, then touch test/lobos/test/integration.clj and run the tests again, the last unit tests fail. After the issue shows up, touch test/lobos/test/schema.clj and everything go back to normal.

lancepantz commented 13 years ago

i got it too. investigating, i'll ping you when i get it figured out

lancepantz commented 13 years ago

If you're interested in a quick fix, you can remove the :reload from the ns decl in lobos.test.integration. Cake watches files and reloads as it needs, so it's not necessary to explicitly direct it.

It looks as if there is indeed a bug in cake that you've found, or possibly lazy test. I'll dig further into it with justin tomorrow and see if we can get it figured out. I'll respond when we have a patch.

take care, cool project btw :)

budu commented 13 years ago

OK, I'll get rid of the :reload option, I'm only running tests from the console anyway. I've been thinking a little more about that issue and start wondering if it is in fact related to the way Clojure load records definition, I've had some problems (http://bit.ly/dEIGXY) with records and protocols while doing REPL-driven development previously.

Thanks

ninjudd commented 12 years ago

Closing since we're moving to lein