Copilot commented on code in PR #3627:
URL: https://github.com/apache/thrift/pull/3627#discussion_r3532079145


##########
lib/rb/spec/thin_http_server_spec.rb:
##########
@@ -20,9 +20,16 @@
 
 require 'spec_helper'
 require 'rack/test'
-require 'thrift/server/thin_http_server'
 
-describe Thrift::ThinHTTPServer do
+begin
+  require 'thrift/server/thin_http_server'
+rescue LoadError
+  # The thin gem is optional and may be excluded on unsupported Ruby versions.
+end
+
+thin_dependency = defined?(Thin) ? {} : { :skip => "thin not available" }
+

Review Comment:
   The skip metadata is derived from `defined?(Thin)`, but the `require 
'thrift/server/thin_http_server'` is wrapped in `rescue LoadError`. If `Thin` 
is already defined for any reason while the require fails (or 
Thrift::ThinHTTPServer isn't loaded), this will run the examples and they can 
fail with NameError. Prefer basing the skip on whether the ThinHTTPServer file 
was successfully required (or whether `Thrift::ThinHTTPServer` is defined).



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to