Test runs by itself, fails when run with everything...

Darryl L. Pierce dpierce at redhat.com
Fri Sep 9 12:29:07 UTC 2011


On Fri, Sep 09, 2011 at 07:42:44AM +0200, Emanuel Rietveld wrote:
> On 09/08/2011 11:23 PM, Darryl L. Pierce wrote:
> > I have a unit test that is failing to run under Rake when it runs with
> > all unit tests. But if I run it by itself using either "rake test
> > TEST=path/to/file" or else run it with ruby using "ruby path/to/file" it
> > passes every time.
> >
> > The failure is caused by the setup method not being invoked before each
> > test, but only for that one class. The setup method in other classes run
> > fine, and in this class as well when it runs by itself.
> >
> > Any suggestions or ideas for what to look at?
> 
> Another test run before it likely breaks this test. Purely out of
> curiosity, can you figure out the test that causes it to break, take
> that and the test that is being broken, and then create the smallest
> possible test suite that also breaks in a similar way (and post it here)?

In doing all of that, it turned out there was another source module
declaring a test with the same name. And it was that test that overrode
setup and caused the uninitialized references.

-- 
Darryl L. Pierce, Sr. Software Engineer @ Red Hat, Inc.
Delivering value year after year.
Red Hat ranks #1 in value among software vendors.
http://www.redhat.com/promo/vendor/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
Url : http://lists.fedoraproject.org/pipermail/ruby-sig/attachments/20110909/231ce78d/attachment.bin 


More information about the ruby-sig mailing list