Just A Summary

Piers Cawley Practices Punditry

What the? 4

Posted by Piers Cawley Sun, 13 May 2007 08:42:00 GMT

Wow:

$ rake spec
...

156 examples, no failures

$ ./script/spec spec
...

156 examples, 2 failures

$ rake
[unit tests, all pass]
[functional tests, all pass]
[specs...]

156 examples, 2 failures

For extra points, the 2 failures from running the plain rake are not the same as the failures from running ./script/spec spec. And if I run ./script/spec spec after a full rake run, I get a host of extra failures.

I wonder what I’m doing to so comprehensively screw up test isolation.

Ho hum.

Comments

Leave a response

  1. Avatar
    Luis Lavena about 7 hours later:

    Piers, trust me: is not you.

    I get the same issues with rake spec (which uses spec/spec.opts)

    Try doing ./script/spec using the same options from that file and see what happens.

    Rake mess up the whole environment and loading of things somehow. Using with rake sometimes give me faulty specs, and sometimes the opposite…

    I know Windows could be the problem, but so much? ;-)

  2. Avatar
    Piers Cawley about 9 hours later:

    I’m pretty sure it’s related to fixture loading, but I haven’t yet worked out how to get things into a good state.

  3. Avatar
    Aristotle Pagaltzis about 13 hours later:

    Does Rake run the tests in (a) separate interpreter(s)?

  4. Avatar
    Piers Cawley about 22 hours later:

    Each set of tests gets run in its own interpreter, so test:units gets one interpreter, test:functionals gets another and spec gets a third.

    I think the issue is related to the problem I worked around by turning off transactional fixtures in the tests. This means that the database isn’t in a pristine state when the specs start up. I assume that the problem with rake spec and ./script/spec spec failing in different places is that they run the specs in a different order, which means they trip over the database issue earlier.

    I’m not going to complain too hard though – fixing it has fixed at least one latent bug in Typo.

Comments



Just A Summary