Feature #4918

Make all core tests inherit from Test::Unit::TestCase

Added by Martin Bosslet almost 3 years ago. Updated almost 3 years ago.

[ruby-core:37289]
Status:Closed
Priority:Low
Assignee:Martin Bosslet
Category:core
Target version:1.9.3

Description

Some tests for OpenSSL inherited from Minitest::Unit::TestCase instead of
Test::Unit::TestCase. To be consistent, all tests should probably inherit from
Test::Unit::TestCase (cf. ).

I would scan through all tests in Ruby core and replace direct Minitest references
except where absolutely required (rubygems, rdoc).

Please let me know if there are other cases where the direct reference to Minitest
is mandatory.

Regards,
Martin

History

#1 Updated by Benoit Daloze almost 3 years ago

Hello,

On 22 June 2011 07:46, Martin Bosslet Martin.Bosslet@googlemail.com wrote:

Some tests for OpenSSL inherited from Minitest::Unit::TestCase instead of
Test::Unit::TestCase. To be consistent, all tests should probably inherit from
Test::Unit::TestCase (cf. ).

I believe some tests using MiniTest are intended to do so.

If it's just a few using MiniTest against a lot using Test for a
particular library, it might be interesting to normalize, but I think
it is fine as is too.

Remember they are not drop-in replacement, notably MiniTest run the
tests in random order.

I would scan through all tests in Ruby core and replace direct Minitest references
except where absolutely required (rubygems, rdoc).

Please let me know if there are other cases where the direct reference to Minitest
is mandatory.

A quick ack -l --invert-file-match -G 'rdoc|rubygems' MiniTest test gives:
test/benchmark/test_benchmark.rb
This is using MiniTest::Spec, and it is intended.

test/fiddle/helper.rb
This affects all Fiddle tests, not sure it should change

test/minitest/testminitestbenchmark.rb
test/minitest/testminitestmock.rb
test/minitest/testminitestspec.rb
test/minitest/testminitestunit.rb
Of course, MiniTest's own tests are written using itself

test/net/smtp/testresponse.rb
test/net/smtp/test
smtp.rb
test/net/smtp/testsslsocket.rb
Can likely be changed, especially since other tests from net/ are using Test

test/profiletestall.rb
Can not be changed, used for profiling

test/psych/helper.rb
This affects all Psych tests, it should not change.
It's Aaron's decision whether to use MiniTest

test/psych/testtoyaml_properties.rb
Should probably use the Psych::TestCase instead of MiniTest::Unit::TestCase

test/runner.rb
It's for "class Gem::TestCase < MiniTest::Unit::TestCase". So, for rubygems.
I think it should be in some helper file rather than in runner.rb

test/syck/test_struct.rb
Should likely be changed

test/testunit/testrakeintegration.rb
test/testunit/testsforparallel/misc.rb
I think the references to MiniTest are intended, these tests being
about integration of MiniTest and Test.

--

To Rubygems maintainers:
Why is Gem::TestCase defined in test/runner.rb rather than some helper
file in test/rubygems ?

Hope it helps,
B.D.

#2 Updated by Eric Hodel almost 3 years ago

On Jun 22, 2011, at 5:41 AM, Benoit Daloze wrote:

On 22 June 2011 07:46, Martin Bosslet Martin.Bosslet@googlemail.com wrote:

Some tests for OpenSSL inherited from Minitest::Unit::TestCase instead of
Test::Unit::TestCase. To be consistent, all tests should probably inherit from
Test::Unit::TestCase (cf. ).

I believe some tests using MiniTest are intended to do so.

If it's just a few using MiniTest against a lot using Test for a
particular library, it might be interesting to normalize, but I think
it is fine as is too.

Remember they are not drop-in replacement, notably MiniTest run the
tests in random order.

I would scan through all tests in Ruby core and replace direct Minitest references
except where absolutely required (rubygems, rdoc).

Please let me know if there are other cases where the direct reference to Minitest
is mandatory.

A quick ack -l --invert-file-match -G 'rdoc|rubygems' MiniTest test gives:

test/runner.rb
It's for "class Gem::TestCase < MiniTest::Unit::TestCase". So, for rubygems.
I think it should be in some helper file rather than in runner.rb

To Rubygems maintainers:
Why is Gem::TestCase defined in test/runner.rb rather than some helper
file in test/rubygems ?

Gem::TestCase is defined in lib/rubygems/test_case.rb (for reuse by RubyGems plugins and extensions). I imagine it is also defined in test/runner.rb to fix some problem when loading the combined test suite.

test/testunit/testrakeintegration.rb
test/testunit/testsforparallel/misc.rb
I think the references to MiniTest are intended, these tests being
about integration of MiniTest and Test.

I've been working on brining rake 0.9.2 into ruby trunk and it will switch to MiniTest::Unit::TestCase

#3 Updated by Martin Bosslet almost 3 years ago

  • Status changed from Assigned to Closed
  • % Done changed from 0 to 100

Benoit Daloze wrote:

A quick ack -l --invert-file-match -G 'rdoc|rubygems' MiniTest test gives:
test/benchmark/test_benchmark.rb
...

Thanks for the analysis, Benoit! As I don't want to fiddle around in other people's domains anyway, I suppose it's fine to agree that it's under the respective maintainers' sovereignty to ensure consistency regarding this issue?

I close this issue then, just wanted to point it out and gain some insight about the underlying philosophy. Thanks for your contribution!

Regards,
Martin

Also available in: Atom PDF