Using the "testing" macro introduces the same problem with fixtures. Fixtures don't run except around things defined with deftest.
Anyone have an example of a test 1) parameterized, and 2) with working fixture? Someone suggested the Expectations lib, but I don't see any fixture support there. Anyone using Expectations that can point me to the right place? On Friday, May 2, 2014 11:38:27 AM UTC-7, Brian Craft wrote: > > Wow, I never would have figured that out from the docs. Thanks. > > Just found a different problem with my solution: nested tests, as > described in the docs, prevent the use of fixtures. You have to add > test-ns-hook when using nested tests, and then fixtures aren't run. > > On Friday, May 2, 2014 11:05:56 AM UTC-7, Karsten Schmidt wrote: >> >> You can use the `testing` macro and wrap it in a function, which accepts >> your type/protocol implementation or even individual protocol methods as >> args. Example here: >> >> https://github.com/thi-ng/geom/blob/master/test/core.org#callable-contexts >> On 2 May 2014 18:08, "Brian Craft" <craft...@gmail.com> wrote: >> >>> Thanks. I did something similar. I have different implementations per >>> db, so use a global *db* var: >>> >>> (ct/deftest run-tests >>> (matrix1)) ; matrix1 tests against *db* >>> >>> (ct/deftest test-h2 >>> (binding [*db* (h2/create-db2 "test" {:subprotocol "h2:mem"})] >>> (run-tests))) >>> >>> (defn test-ns-hook [] >>> (test-h2)) >>> >>> Clumsy, but seems to be the only option. >>> >>> On Friday, May 2, 2014 8:29:23 AM UTC-7, Chris Price wrote: >>>> >>>> I have been curious about this too. I was playing around with it a few >>>> weeks ago and came up with this: >>>> >>>> https://github.com/cprice404/clj-shared-test-sandbox/blob/ >>>> master/test/shared_tests_foo/core_test.clj >>>> >>>> Which is pretty gross; it uses `binding` + a dynamic var in the shared >>>> test namespace, and then it calls `clojure.test/run-tests` from inside of >>>> a >>>> `deftest`. I'm sure there's got to be a better way, but that was as far >>>> as >>>> I got in the small amount of time that I was able to spend on it. >>>> >>>> On Thursday, May 1, 2014 5:58:51 PM UTC-7, Brian Craft wrote: >>>>> >>>>> I have a number of tests that I would like to run against different >>>>> implementations of a protocol. In clojure.test there doesn't appear to be >>>>> a >>>>> way to parameterize a test over the implementations. Is there a good way >>>>> to >>>>> do this? >>>>> >>>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Clojure" group. >>> To post to this group, send email to clo...@googlegroups.com >>> Note that posts from new members are moderated - please be patient with >>> your first post. >>> To unsubscribe from this group, send email to >>> clojure+u...@googlegroups.com >>> For more options, visit this group at >>> http://groups.google.com/group/clojure?hl=en >>> --- >>> You received this message because you are subscribed to the Google >>> Groups "Clojure" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to clojure+u...@googlegroups.com. >>> For more options, visit https://groups.google.com/d/optout. >>> >> -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.