testing

fabrao 2021-11-06T18:37:47.003600Z

Hello, Is there any way to configure dynamicaly a fixture? How do I pass information to use-fixtures to configure a file that will be used?

mauricio.szabo 2021-11-07T14:24:14.004900Z

Or don't use fixtures at all. Seriously, I never use fixtures because they are quite unpredictable in some situations - in general, I use a macro around the test with a try...finally for teardowns. Makes everything easier πŸ™‚

πŸ‘ 1
thom 2021-11-07T14:25:59.006800Z

How do you find them unpredictable? They're certainly a bit suboptimal as implemented in Clojure just because they don't interact with β€˜testing’ blocks in any useful way, but they've generally done what I expect, at least.

mauricio.szabo 2021-11-07T14:54:36.007Z

In async ClojureScript contexts, they behave strangely, for example; you can't evaluate test fragments like testing and make fixtures run; you're forced to use run-test or similar code (and these don't interact that well with ClojureScript also), and other small problems...

mauricio.szabo 2021-11-07T14:55:57.007200Z

For Clojure, they do generally work, with the exception of losing the ability to evaluate test fragments and being forced to work with run-test and friends. But in ClojureScript, when you have async tests, most of the "core utilities to woth with tests" like with-redefs for example break down hard 😞

πŸ‘† 1
thom 2021-11-07T15:20:18.007400Z

Gotcha, interesting

thom 2021-11-06T21:52:18.004700Z

Make a function that returns a function. So you call (use-fixture :each (my-fixture config)) etc