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

Fix deprecation test when ran multiple times #695

Merged
merged 1 commit into from
Aug 26, 2023
Merged

Conversation

peterzhu2118
Copy link
Member

The deprecation warning is only printed on the first time the test is ran, so subsequent runs will fail because the error message will not be printed. This can be seen in the Ruby CI logs such as http://ci.rvm.jp/results/trunk-repeat50@ruby-sp2-docker/4696313:

1) Failure:
TestIRB::RubyLexTest#test_initialising_the_old_top_level_ruby_lex [/tmp/ruby/src/trunk-repeat50/test/irb/test_ruby_lex.rb:210]:
Expected /warning: constant ::RubyLex is deprecated/ to match "".

It can also be reproduced in the Ruby repo with the following test command:

make test/irb/test_ruby_lex.rb TESTOPTS=--repeat-count=2

This commit changes the test to use assert_in_out_err, which spawns a new Ruby process.

The deprecation warning is only printed on the first time the test is
ran, so subsequent runs will fail because the error message will not be
printed. This can be seen in the Ruby CI logs such as
http://ci.rvm.jp/results/trunk-repeat50@ruby-sp2-docker/4696313:

    1) Failure:
    TestIRB::RubyLexTest#test_initialising_the_old_top_level_ruby_lex [/tmp/ruby/src/trunk-repeat50/test/irb/test_ruby_lex.rb:210]:
    Expected /warning: constant ::RubyLex is deprecated/ to match "".

It can also be reproduced in the Ruby repo with the following test
command:

    make test/irb/test_ruby_lex.rb TESTOPTS=--repeat-count=2

This commit changes the test to use assert_in_out_err, which spawns a
new Ruby process.
Copy link
Member

@st0012 st0012 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry that I didn't know it's only printed once. Thank you so much for the fix 🙏

@st0012 st0012 merged commit ae0e5bb into master Aug 26, 2023
47 checks passed
@st0012 st0012 deleted the pz-fix-rubylex-test branch August 26, 2023 13:56
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.

2 participants