pathname icon indicating copy to clipboard operation
pathname copied to clipboard

test: use Test::Unit::TestCase.ractor

Open kou opened this issue 1 year ago • 7 comments

Instead of using assert_separately. If we use .ractor, we can use the same process for tests that use Ractor. It's easy to debug.

kou avatar Apr 30 '24 13:04 kou

Can we use this feature on ruby/ruby repo? If It's No, we skip this test at ruby/ruby repo.

I'm happy to port this feature to https://github.com/ruby/ruby/blob/master/tool/lib/test/unit/testcase.rb

hsbt avatar May 01 '24 02:05 hsbt

Can we use this feature on ruby/ruby repo?

No.

If It's No, we skip this test at ruby/ruby repo.

Right.

I'm happy to port this feature to https://github.com/ruby/ruby/blob/master/tool/lib/test/unit/testcase.rb

Thanks. We just need to run tests that use Ractor after other tests that don't use Ractor. The ractor method just mark tests that use Ractor.

kou avatar May 01 '24 05:05 kou

I'm happy to port this feature to https://github.com/ruby/ruby/blob/master/tool/lib/test/unit/testcase.rb

Thanks. We just need to run tests that use Ractor after other tests that don't use Ractor. The ractor method just mark tests that use Ractor.

ruby/ruby's test runs per classes, or per files in parallel mode. It doesn't seem a trivial change to split test cases per methods, unfortunately.

nobu avatar May 05 '24 04:05 nobu

core_assertions.rb defines assert_ractor, that is similar to assert_separately but suppress the Ractor warning first. This PR removes $VERBOSE = nil, and it will show the warning?

https://github.com/ruby/pathname/actions/runs/8895915304/job/24427357987?pr=38#step:5:20

/home/runner/work/pathname/pathname/test/pathname/test_ractor.rb:9: warning: Ractor is experimental, and the behavior may change in future versions of Ruby! Also there are many implementation issues.

nobu avatar May 05 '24 04:05 nobu

I think that we don't need to suppress the Ractor warning. So test-unit doesn't suppress the warning automatically. If we should suppress the Ractor warning, I'll do it in test-unit.

kou avatar May 05 '24 06:05 kou

Well, it would be a preference matter, like as test-unit shows omit messages by default, while ruby/ruby not.

Also it's because assert_ractor would be too noisy unless suppressing the warning, since it runs a process for each assertion.

nobu avatar May 05 '24 13:05 nobu

I see. test-unit shows omit messages by default but doesn't show such messages by default on GitHub Actions: https://github.com/test-unit/test-unit/blob/d4183f6688fa8bc83566224aaaf66c51f8434bae/lib/test/unit/ui/console/testrunner.rb#L538-L539 So I'll change test-unit to suppress the Ractor warning by default on GitHub Actions.

kou avatar May 05 '24 21:05 kou