Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Trying to use Test::Unit in a MiniTest::Unit project #16

Closed
soffes opened this Issue Jun 8, 2012 · 9 comments

Comments

Projects
None yet
4 participants
Contributor

soffes commented Jun 8, 2012

Here's the relevant code: https://gist.github.com/8683a564ce772ce7c67f I can post anything else if you want.

Here's the output from m:

$ m test/units/client_test.rb:4
Coverage report generated for Integration Tests, Unit Tests to /Users/samsoffes/Code/cheddarapp.com/coverage. 705 / 825 LOC (85.45%) covered.
/Users/samsoffes/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/m-1.1.0/lib/m.rb:164:in `execute': uninitialized constant Test::Unit::AutoRunner (NameError)
    from /Users/samsoffes/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/m-1.1.0/lib/m.rb:120:in `run'
    from /Users/samsoffes/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/m-1.1.0/lib/m.rb:105:in `run'
    from /Users/samsoffes/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/m-1.1.0/bin/m:4:in `<top (required)>'
    from /Users/samsoffes/.rbenv/versions/1.9.3-p194/bin/m:23:in `load'
    from /Users/samsoffes/.rbenv/versions/1.9.3-p194/bin/m:23:in `<main>'

I tried running m on a single file test with MiniTest::Unit and everything was fine. I'm guessing Rails is loading Test::Unit somewhere. Maybe the check for MiniTest::Unit should be moved before Test::Unit since that's more likely to be loaded and not actually used. Just an idea.

Contributor

soffes commented Jun 8, 2012

I made sure to not require rails/test_unit, but it's still trying to load with Test::Unit.

Contributor

soffes commented Jun 9, 2012

This fixes it for me https://github.com/samsoffes/m/commit/18d567c3b4dd34f448b0da9186aba790b2a129a1 I can pull request if you like. I know this is kind of a hack.

This is interesting, I am having the same problems and tried the same experiment to move MiniTest first, like you did. However, my errors are different. The first error is a stock error, the second one is what I get when I move the code around like in your patch.

ScreenShot

Owner

qrush commented Jul 31, 2012

Cleaning out issues...does this still happen with m 1.2.0?

Contributor

soffes commented Jul 31, 2012

It's still happening:

/Users/samsoffes/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/m-1.2.0/lib/m.rb:191:in `execute': uninitialized constant Test::Unit::AutoRunner (NameError)
from /Users/samsoffes/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/m-1.2.0/lib/m.rb:120:in `run'
    from /Users/samsoffes/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/m-1.2.0/lib/m.rb:105:in `run'
    from /Users/samsoffes/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/m-1.2.0/bin/m:4:in `<top (required)>'
    from /Users/samsoffes/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bin/m:23:in `load'
    from /Users/samsoffes/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bin/m:23:in `<main>'

My fork works fine though.

Contributor

metaskills commented Jul 31, 2012

@qrush I made this comment in my issue #12 but did not issue another pull request. This needs to push MiniTest::Unit as the first if condition.

https://github.com/qrush/m/blob/master/lib/m.rb#L190-193

Owner

qrush commented Jul 31, 2012

Pushing out 1.2.1 with this. Thanks!

@qrush qrush closed this Jul 31, 2012

Contributor

soffes commented Jul 31, 2012

<3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment