Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

kou
Copy link
Member

@kou kou commented Apr 30, 2024

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.

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
Copy link
Member

hsbt commented May 1, 2024

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
Copy link
Member Author

kou commented May 1, 2024

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 kou mentioned this pull request May 4, 2024
@nobu
Copy link
Member

nobu commented May 5, 2024

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
Copy link
Member

nobu commented May 5, 2024

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
Copy link
Member Author

kou commented May 5, 2024

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
Copy link
Member

nobu commented May 5, 2024

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
Copy link
Member Author

kou commented May 5, 2024

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.

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

Successfully merging this pull request may close these issues.

None yet

3 participants