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
[🐛 Bug]: [rb] rspec spec/unit aborts with ruby3.2 #11498
Comments
@mtasaka, thank you for creating this issue. We will troubleshoot it as soon as we can. Info for maintainersTriage this issue by using labels.
If information is missing, add a helpful comment and then
If the issue is a question, add the
If the issue is valid but there is no time to troubleshoot it, consider adding the
If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C),
add the applicable
After troubleshooting the issue, please add the Thank you! |
So:
|
…reopen In selenium rb rspec test suite, rspec mocks `File.exist?` method partway. With ruby3.2, this may confuse `::Logger.new` using `$stdout` as output because of `IO` class being changed to accept `#path` method. Then it may close `$stdout` with `::Logger.reopen` via `have_deprecated` rspec matcher defined in selenium internally. So when using have_deprecated matcher defined inside selenium, instead of using Logger.reopen, redirect stdout directly, using `Tempfile` and reopen `$stdout` directly. Also, as said above, with ruby 3.2 `IO` also accepts `#path` method, so `IO#path.exists?` is now valid on ruby3.2. This affects 'uses the given jar file and port' testsuite in spec/unit/selenium/server_spec.rb: `File` class must be mocked so that `#exist?` method accepts also '<STDOUT>` argument. Closes SeleniumHQ#11498 .
Thanks for bringing this to our attention and walking through all of this. Couldn't we address this by just initializing the logger at the beginning of the suite so that when it is created nothing is mocked? |
Well, first I tried so like adding
to After all, |
The second problem is that the logger specs set it to nil, completely unnecessarily at this point, and the next call to logger has issues. Just initializing it in the helper
And removing the line in the logger spec and it should work as desired without messing with the matchers |
I may be misunderstanding what you commented, however if you just mean:
Then this is already what I commented and this does not work. Note that (again may be I am misunderstanding what you commented but) |
Yeah, I'm saying this line is the other troublemaker that keeps things from working properly: https://github.com/SeleniumHQ/selenium/blob/trunk/rb/spec/unit/selenium/webdriver/common/logger_spec.rb#L32 and it is completely unnecessary because we aren't even referencing |
fixed here - 590cfbb |
Yes, confirmed, thank you. |
What happened?
With selenium git head ( 21fe296 ), rspec test suite
"aborts" (raises expection) with ruby3.2.0.
The below log shows that
rspec
test suitespec/unit/selenium/webdriver/chrome/service_spec.rb
service_spec.rb
)and then raises exception internally.
How can we reproduce the issue?
`$ rspec -f d spec/unit`
Relevant log output
Operating System
Fedora 38 x86_64
Selenium version
ruby 3.2.0 (2022-12-25 revision a528908271) [x86_64-linux]
What are the browser(s) and version(s) where you see this issue?
No relevant
What are the browser driver(s) and version(s) where you see this issue?
No relevant
Are you using Selenium Grid?
No response
The text was updated successfully, but these errors were encountered: