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

Rexml or Nokogiri? #137

Open
voxik opened this issue Jun 16, 2023 · 0 comments
Open

Rexml or Nokogiri? #137

voxik opened this issue Jun 16, 2023 · 0 comments

Comments

@voxik
Copy link
Contributor

voxik commented Jun 16, 2023

PR #87 introduced hard dependency on ReXML. However, the irony is that the Nokogiri is actually preferred and the whole test suite is executed against Nokogiri. On top of that, if Nokogiri is not available, there are ~170 test failures such as:

  2) DBus::Service when a private bus is set up #exists? is true for an existing service
     Failure/Error: @doc = Nokogiri.XML(xml)
     
     NameError:
       uninitialized constant DBus::IntrospectXMLParser::NokogiriParser::Nokogiri
     # ./lib/dbus/xml.rb:81:in `initialize'
     # ./lib/dbus/xml.rb:127:in `new'
     # ./lib/dbus/xml.rb:127:in `parse'
     # ./lib/dbus/proxy_object_factory.rb:33:in `introspect_into'
     # ./lib/dbus/proxy_object.rb:80:in `introspect'
     # ./spec/bus_driver_spec.rb:20:in `block (4 levels) in <top (required)>'
     # ./spec/spec_helper.rb:119:in `with_service_by_activation'
     # ./spec/bus_driver_spec.rb:11:in `block (4 levels) in <top (required)>'
     # ./spec/spec_helper.rb:95:in `block (2 levels) in with_private_bus'
     # ./spec/spec_helper.rb:66:in `with_env'
     # ./spec/spec_helper.rb:94:in `block in with_private_bus'
     # ./spec/spec_helper.rb:66:in `with_env'
     # ./spec/spec_helper.rb:77:in `with_private_bus'
     # ./spec/bus_driver_spec.rb:10:in `block (3 levels) in <top (required)>'

as soon as the BusAndXmlBackendTest tests introspection reading nokogiri test case is executed, because it sets the backend to Nokogiri without reseting it back to the original value:

DBus::IntrospectXMLParser.backend = DBus::IntrospectXMLParser::NokogiriParser

I'd like to clarify this situation.

If both backends are really equal, then the two test cases should be probably merged into one, where the XML backend is defined by the available package set (or by some env variable) and the test suite should be run twice, once with Nokogiri and the other time with ReXML.

It also is suboptimal to always pull in ReXML gem, when Nokogiri is going to be used. Ideally, there should be no implicit dependency. Maybe the default behavior should be to just gracefully fail if there is no XML parser available. Or only one XML parser could be supported ...

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

No branches or pull requests

1 participant