ruby-rdf / rdf-turtle

Turtle reader/writer for Ruby
http://rubygems.org/gems/rdf-turtle
The Unlicense
31 stars 9 forks source link

RSpec fails "unrecognized option: base_uri (ArgumentError)" #10

Closed petervandenabeele closed 10 years ago

petervandenabeele commented 10 years ago

I am quite confused by this Rspec failure.

I have uploaded the latest rdf-turtle, rdf, ...

This exact same test passed 5 days ago on Travis (I also replayed all the travis commands and that all passed, up to the failure below).

The failure occurs in

 class Manifest < JSON::LD::Resource
      def self.open(file)
        puts "open: #{file}"
        prefixes = {}
        g = RDF::Repository.load(file, :format => :ttl)
        JSON::LD::API.fromRDF(g) do |expanded|
          JSON::LD::API.frame(expanded, FRAME) do |framed|
            yield Manifest.new(framed['@graph'].first)
          end
        end
      end

when trying to read from:

open: https://dvcs.w3.org/hg/rdf/raw-file/default/rdf-turtle/tests-nt/manifest.ttl

I am puzzled by the "unrecognized option: base_uri ...".

More context at the bottom of this ticket.

Thanks !

➜  rdf-turtle git:(d2d8801) ✗   bundle exec rspec spec
open: https://dvcs.w3.org/hg/rdf/raw-file/default/rdf-turtle/tests-nt/manifest.ttl
/Users/peter_v/.rvm/rubies/ruby-2.0.0-p451/lib/ruby/2.0.0/open-uri.rb:115:in `block in check_options': unrecognized option: base_uri (ArgumentError)
    from /Users/peter_v/.rvm/rubies/ruby-2.0.0-p451/lib/ruby/2.0.0/open-uri.rb:112:in `each'
    from /Users/peter_v/.rvm/rubies/ruby-2.0.0-p451/lib/ruby/2.0.0/open-uri.rb:112:in `check_options'
    from /Users/peter_v/.rvm/rubies/ruby-2.0.0-p451/lib/ruby/2.0.0/open-uri.rb:136:in `open_uri'
    from /Users/peter_v/.rvm/gems/ruby-2.0.0-p451@rdf/gems/open-uri-cached-0.0.5/lib/open-uri/cached.rb:10:in `open_uri'
    from /Users/peter_v/.rvm/rubies/ruby-2.0.0-p451/lib/ruby/2.0.0/open-uri.rb:689:in `open'
    from /Users/peter_v/.rvm/rubies/ruby-2.0.0-p451/lib/ruby/2.0.0/open-uri.rb:34:in `open'
    from /Users/peter_v/Documents/data/github/petervandenabeele/rdf-turtle/spec/suite_helper.rb:50:in `open_file'
    from /Users/peter_v/.rvm/gems/ruby-2.0.0-p451@rdf/bundler/gems/rdf-7b950c9ed770/lib/rdf/reader.rb:136:in `open'
    from /Users/peter_v/.rvm/gems/ruby-2.0.0-p451@rdf/bundler/gems/rdf-7b950c9ed770/lib/rdf/mixin/mutable.rb:43:in `load'
    from /Users/peter_v/.rvm/gems/ruby-2.0.0-p451@rdf/bundler/gems/rdf-7b950c9ed770/lib/rdf/repository.rb:81:in `block (2 levels) in load'
    from /Users/peter_v/.rvm/gems/ruby-2.0.0-p451@rdf/bundler/gems/rdf-7b950c9ed770/lib/rdf/repository.rb:80:in `each'
    from /Users/peter_v/.rvm/gems/ruby-2.0.0-p451@rdf/bundler/gems/rdf-7b950c9ed770/lib/rdf/repository.rb:80:in `block in load'
    from /Users/peter_v/.rvm/gems/ruby-2.0.0-p451@rdf/bundler/gems/rdf-7b950c9ed770/lib/rdf/repository.rb:114:in `call'
    from /Users/peter_v/.rvm/gems/ruby-2.0.0-p451@rdf/bundler/gems/rdf-7b950c9ed770/lib/rdf/repository.rb:114:in `initialize'
    from /Users/peter_v/.rvm/gems/ruby-2.0.0-p451@rdf/bundler/gems/rdf-7b950c9ed770/lib/rdf/repository.rb:79:in `new'
    from /Users/peter_v/.rvm/gems/ruby-2.0.0-p451@rdf/bundler/gems/rdf-7b950c9ed770/lib/rdf/repository.rb:79:in `load'
    from /Users/peter_v/Documents/data/github/petervandenabeele/rdf-turtle/spec/suite_helper.rb:98:in `open'
    from /Users/peter_v/Documents/data/github/petervandenabeele/rdf-turtle/spec/ntriples_spec.rb:10:in `block (3 levels) in <top (required)>'
    from /Users/peter_v/Documents/data/github/petervandenabeele/rdf-turtle/spec/ntriples_spec.rb:9:in `each'
    from /Users/peter_v/Documents/data/github/petervandenabeele/rdf-turtle/spec/ntriples_spec.rb:9:in `block (2 levels) in <top (required)>'
    from /Users/peter_v/.rvm/gems/ruby-2.0.0-p451@rdf/gems/rspec-core-2.14.8/lib/rspec/core/example_group.rb:246:in `module_eval'
    from /Users/peter_v/.rvm/gems/ruby-2.0.0-p451@rdf/gems/rspec-core-2.14.8/lib/rspec/core/example_group.rb:246:in `subclass'
    from /Users/peter_v/.rvm/gems/ruby-2.0.0-p451@rdf/gems/rspec-core-2.14.8/lib/rspec/core/example_group.rb:232:in `describe'
    from /Users/peter_v/Documents/data/github/petervandenabeele/rdf-turtle/spec/ntriples_spec.rb:6:in `block in <top (required)>'
    from /Users/peter_v/.rvm/gems/ruby-2.0.0-p451@rdf/gems/rspec-core-2.14.8/lib/rspec/core/example_group.rb:246:in `module_eval'
    from /Users/peter_v/.rvm/gems/ruby-2.0.0-p451@rdf/gems/rspec-core-2.14.8/lib/rspec/core/example_group.rb:246:in `subclass'
    from /Users/peter_v/.rvm/gems/ruby-2.0.0-p451@rdf/gems/rspec-core-2.14.8/lib/rspec/core/example_group.rb:232:in `describe'
    from /Users/peter_v/.rvm/gems/ruby-2.0.0-p451@rdf/gems/rspec-core-2.14.8/lib/rspec/core/dsl.rb:18:in `describe'
    from /Users/peter_v/Documents/data/github/petervandenabeele/rdf-turtle/spec/ntriples_spec.rb:4:in `<top (required)>'
    from /Users/peter_v/.rvm/gems/ruby-2.0.0-p451@rdf/gems/rspec-core-2.14.8/lib/rspec/core/configuration.rb:896:in `load'
    from /Users/peter_v/.rvm/gems/ruby-2.0.0-p451@rdf/gems/rspec-core-2.14.8/lib/rspec/core/configuration.rb:896:in `block in load_spec_files'
    from /Users/peter_v/.rvm/gems/ruby-2.0.0-p451@rdf/gems/rspec-core-2.14.8/lib/rspec/core/configuration.rb:896:in `each'
    from /Users/peter_v/.rvm/gems/ruby-2.0.0-p451@rdf/gems/rspec-core-2.14.8/lib/rspec/core/configuration.rb:896:in `load_spec_files'
    from /Users/peter_v/.rvm/gems/ruby-2.0.0-p451@rdf/gems/rspec-core-2.14.8/lib/rspec/core/command_line.rb:22:in `run'
    from /Users/peter_v/.rvm/gems/ruby-2.0.0-p451@rdf/gems/rspec-core-2.14.8/lib/rspec/core/runner.rb:80:in `run'
    from /Users/peter_v/.rvm/gems/ruby-2.0.0-p451@rdf/gems/rspec-core-2.14.8/lib/rspec/core/runner.rb:17:in `block in autorun'
➜  rdf-turtle git:(d2d8801) ✗ 

Some set-up:

➜  rdf-turtle git:(d2d8801) bundle update
Updating git://github.com/ruby-rdf/rdf.git
Updating git://github.com/ruby-rdf/rdf-spec.git
Updating git://github.com/ruby-rdf/rdf-isomorphic.git
Updating git://github.com/ruby-rdf/json-ld.git
Updating git://github.com/gkellogg/ebnf.git
Fetching gem metadata from http://rubygems.org/.........
Fetching additional metadata from http://rubygems.org/..
Resolving dependencies...
Using rake 10.3.2
Using columnize 0.8.9
Using debugger-linecache 1.2.0
Using byebug 3.1.2
Using diff-lcs 1.2.5
Using tilt 2.0.1
Using haml 4.0.5
Using rdf 1.1.3 from git://github.com/ruby-rdf/rdf.git (at develop)
Using sxp 0.1.5
Using ebnf 0.3.6 from git://github.com/gkellogg/ebnf.git (at develop)
Using json-ld 1.1.4 from git://github.com/ruby-rdf/json-ld.git (at develop)
Using open-uri-cached 0.0.5
Using rdf-isomorphic 1.1.0 from git://github.com/ruby-rdf/rdf-isomorphic.git (at develop)
Using rspec-core 2.14.8
Using rspec-expectations 2.14.5
Using rspec-mocks 2.14.6
Using rspec 2.14.1
Using rdf-spec 1.1.3 from git://github.com/ruby-rdf/rdf-spec.git (at develop)
Using rdf-turtle 1.1.3.1 from source at .
Using wirble 0.1.3
Using yard 0.8.7.4
Using bundler 1.6.2
Your bundle is updated!

Also trying to replay the succesfull Travis tests ...


➜  rdf-turtle git:(d2d8801) rvm use 2.0 --install --binary --fuzzy       
Using /Users/peter_v/.rvm/gems/ruby-2.0.0-p451
➜  rdf-turtle git:(d2d8801) export BUNDLE_GEMFILE=$PWD/Gemfile
➜  rdf-turtle git:(d2d8801) ruby --version
ruby 2.0.0p451 (2014-02-24 revision 45167) [x86_64-darwin13.1.0]
➜  rdf-turtle git:(d2d8801) rvm --version

rvm 1.25.25 (stable) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]

➜  rdf-turtle git:(d2d8801) 
➜  rdf-turtle git:(d2d8801) gem --version
2.0.14
➜  rdf-turtle git:(d2d8801) bundle --version
zsh: command not found: bundle
➜  rdf-turtle git:(d2d8801) rvm gemset use rdf
Using ruby-2.0.0-p451 with gemset rdf
➜  rdf-turtle git:(d2d8801) gem --version   
2.0.14
➜  rdf-turtle git:(d2d8801) bundle --version
Bundler version 1.6.2

➜  rdf-turtle git:(d2d8801) bundle install --without debug                                      
Resolving dependencies...
Using rake 10.3.2
Using diff-lcs 1.2.5
Using tilt 2.0.1
Using haml 4.0.5
Using rdf 1.1.3 from git://github.com/ruby-rdf/rdf.git (at develop)
Using sxp 0.1.5
Using ebnf 0.3.6 from git://github.com/gkellogg/ebnf.git (at develop)
Using json-ld 1.1.4 from git://github.com/ruby-rdf/json-ld.git (at develop)
Using open-uri-cached 0.0.5
Using rdf-isomorphic 1.1.0 from git://github.com/ruby-rdf/rdf-isomorphic.git (at develop)
Using rspec-core 2.14.8
Using rspec-expectations 2.14.5
Using rspec-mocks 2.14.6
Using rspec 2.14.1
Using rdf-spec 1.1.3 from git://github.com/ruby-rdf/rdf-spec.git (at develop)
Using rdf-turtle 1.1.3.1 from source at .
Using yard 0.8.7.4
Using bundler 1.6.2
Your bundle is complete!
Gems in the group debug were not installed.
Use `bundle show [gemname]` to see where a bundled gem is installed.
➜  rdf-turtle git:(d2d8801)     bundle exec rspec spec
/Users/peter_v/.rvm/rubies/ruby-2.0.0-p451/lib/ruby/2.0.0/open-uri.rb:115:in `block in check_options': unrecognized option: base_uri (ArgumentError)
    from /Users/peter_v/.rvm/rubies/ruby-2.0.0-p451/lib/ruby/2.0.0/open-uri.rb:112:in `each'
    from /Users/peter_v/.rvm/rubies/ruby-2.0.0-p451/lib/ruby/2.0.0/open-uri.rb:112:in `check_options'
    from /Users/peter_v/.rvm/rubies/ruby-2.0.0-p451/lib/ruby/2.0.0/open-uri.rb:136:in `open_uri'
    from /Users/peter_v/.rvm/gems/ruby-2.0.0-p451@rdf/gems/open-uri-cached-0.0.5/lib/open-uri/cached.rb:10:in `open_uri'
    from /Users/peter_v/.rvm/rubies/ruby-2.0.0-p451/lib/ruby/2.0.0/open-uri.rb:689:in `open'
    from /Users/peter_v/.rvm/rubies/ruby-2.0.0-p451/lib/ruby/2.0.0/open-uri.rb:34:in `open'
    from /Users/peter_v/Documents/data/github/petervandenabeele/rdf-turtle/spec/suite_helper.rb:50:in `open_file'
    from /Users/peter_v/.rvm/gems/ruby-2.0.0-p451@rdf/bundler/gems/rdf-7b950c9ed770/lib/rdf/reader.rb:136:in `open'
    from /Users/peter_v/.rvm/gems/ruby-2.0.0-p451@rdf/bundler/gems/rdf-7b950c9ed770/lib/rdf/mixin/mutable.rb:43:in `load'
    from /Users/peter_v/.rvm/gems/ruby-2.0.0-p451@rdf/bundler/gems/rdf-7b950c9ed770/lib/rdf/repository.rb:81:in `block (2 levels) in load'
    from /Users/peter_v/.rvm/gems/ruby-2.0.0-p451@rdf/bundler/gems/rdf-7b950c9ed770/lib/rdf/repository.rb:80:in `each'
    from /Users/peter_v/.rvm/gems/ruby-2.0.0-p451@rdf/bundler/gems/rdf-7b950c9ed770/lib/rdf/repository.rb:80:in `block in load'
    from /Users/peter_v/.rvm/gems/ruby-2.0.0-p451@rdf/bundler/gems/rdf-7b950c9ed770/lib/rdf/repository.rb:114:in `call'
    from /Users/peter_v/.rvm/gems/ruby-2.0.0-p451@rdf/bundler/gems/rdf-7b950c9ed770/lib/rdf/repository.rb:114:in `initialize'
    from /Users/peter_v/.rvm/gems/ruby-2.0.0-p451@rdf/bundler/gems/rdf-7b950c9ed770/lib/rdf/repository.rb:79:in `new'
    from /Users/peter_v/.rvm/gems/ruby-2.0.0-p451@rdf/bundler/gems/rdf-7b950c9ed770/lib/rdf/repository.rb:79:in `load'
    from /Users/peter_v/Documents/data/github/petervandenabeele/rdf-turtle/spec/suite_helper.rb:98:in `open'
    from /Users/peter_v/Documents/data/github/petervandenabeele/rdf-turtle/spec/ntriples_spec.rb:10:in `block (3 levels) in <top (required)>'
    from /Users/peter_v/Documents/data/github/petervandenabeele/rdf-turtle/spec/ntriples_spec.rb:9:in `each'
    from /Users/peter_v/Documents/data/github/petervandenabeele/rdf-turtle/spec/ntriples_spec.rb:9:in `block (2 levels) in <top (required)>'
    from /Users/peter_v/.rvm/gems/ruby-2.0.0-p451@rdf/gems/rspec-core-2.14.8/lib/rspec/core/example_group.rb:246:in `module_eval'
    from /Users/peter_v/.rvm/gems/ruby-2.0.0-p451@rdf/gems/rspec-core-2.14.8/lib/rspec/core/example_group.rb:246:in `subclass'
    from /Users/peter_v/.rvm/gems/ruby-2.0.0-p451@rdf/gems/rspec-core-2.14.8/lib/rspec/core/example_group.rb:232:in `describe'
    from /Users/peter_v/Documents/data/github/petervandenabeele/rdf-turtle/spec/ntriples_spec.rb:6:in `block in <top (required)>'
    from /Users/peter_v/.rvm/gems/ruby-2.0.0-p451@rdf/gems/rspec-core-2.14.8/lib/rspec/core/example_group.rb:246:in `module_eval'
    from /Users/peter_v/.rvm/gems/ruby-2.0.0-p451@rdf/gems/rspec-core-2.14.8/lib/rspec/core/example_group.rb:246:in `subclass'
    from /Users/peter_v/.rvm/gems/ruby-2.0.0-p451@rdf/gems/rspec-core-2.14.8/lib/rspec/core/example_group.rb:232:in `describe'
    from /Users/peter_v/.rvm/gems/ruby-2.0.0-p451@rdf/gems/rspec-core-2.14.8/lib/rspec/core/dsl.rb:18:in `describe'
    from /Users/peter_v/Documents/data/github/petervandenabeele/rdf-turtle/spec/ntriples_spec.rb:4:in `<top (required)>'
    from /Users/peter_v/.rvm/gems/ruby-2.0.0-p451@rdf/gems/rspec-core-2.14.8/lib/rspec/core/configuration.rb:896:in `load'
    from /Users/peter_v/.rvm/gems/ruby-2.0.0-p451@rdf/gems/rspec-core-2.14.8/lib/rspec/core/configuration.rb:896:in `block in load_spec_files'
    from /Users/peter_v/.rvm/gems/ruby-2.0.0-p451@rdf/gems/rspec-core-2.14.8/lib/rspec/core/configuration.rb:896:in `each'
    from /Users/peter_v/.rvm/gems/ruby-2.0.0-p451@rdf/gems/rspec-core-2.14.8/lib/rspec/core/configuration.rb:896:in `load_spec_files'
    from /Users/peter_v/.rvm/gems/ruby-2.0.0-p451@rdf/gems/rspec-core-2.14.8/lib/rspec/core/command_line.rb:22:in `run'
    from /Users/peter_v/.rvm/gems/ruby-2.0.0-p451@rdf/gems/rspec-core-2.14.8/lib/rspec/core/runner.rb:80:in `run'
    from /Users/peter_v/.rvm/gems/ruby-2.0.0-p451@rdf/gems/rspec-core-2.14.8/lib/rspec/core/runner.rb:17:in `block in autorun'
➜  rdf-turtle git:(d2d8801) 
gkellogg commented 10 years ago

It seems that at some point Kernel/OpenURI.open became more picky about unexpected options. my own development skips this path, as I use a local copy of the tests, so thanks for finding. Note, the same pattern exists in many of the other gems, so this fix will need to be repeated.

This is not an issue in RDF::Util::File.open_file, as it no longer uses Kernel.open.

petervandenabeele commented 10 years ago

Thanks, all tests pass now :-)

(and I can successfully import a Webprotege OWL2 ontology that I exported in turtle format).