ruby / pathname

Pathname represents the name of a file or directory on the filesystem, but not the file itself.
BSD 2-Clause "Simplified" License
26 stars 16 forks source link

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

Open kou opened 4 months ago

kou commented 4 months ago

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.

hsbt commented 4 months ago

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

kou commented 4 months ago

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.

nobu commented 4 months ago

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 commented 4 months ago

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.

kou commented 4 months ago

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.

nobu commented 4 months ago

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.

kou commented 4 months ago

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.