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

'bundle exec rake' on a fresh clone gives a backtrace (cannot load 'test-unit') #43

Open
ernstki opened this issue Jan 14, 2020 · 5 comments

Comments

@ernstki
Copy link

ernstki commented Jan 14, 2020

I'm using the built-in Ruby 2.3.x on macOS 10.14 (Mojave), with only the bundler and mdless gems installed in my user directory.

I just want to run the tests for mdless without installing any gems in my user or system lib directories. What I tried:

git clone https://github.com/ttscoff/mdless.git
bundle install --path vendor/bundle
bundle exec rake

…expecting the test target to run.

What I got instead was a backtrace: `require': cannot load such file -- test/unit
$ bundle exec rake
/Users/myuser/devel/util/mdless/test/test_helper.rb:1:in `require': cannot load such file -- test/unit (LoadError)
	from /Users/myuser/devel/util/mdless/test/test_helper.rb:1:in `'
	from /Users/myuser/devel/util/mdless/test/default_test.rb:1:in `require'
	from /Users/myuser/devel/util/mdless/test/default_test.rb:1:in `'
	from /Users/myuser/devel/util/mdless/vendor/bundle/ruby/2.3.0/gems/rake-0.9.6/lib/rake/rake_test_loader.rb:15:in `require'
	from /Users/myuser/devel/util/mdless/vendor/bundle/ruby/2.3.0/gems/rake-0.9.6/lib/rake/rake_test_loader.rb:15:in `block in '
	from /Users/myuser/devel/util/mdless/vendor/bundle/ruby/2.3.0/gems/rake-0.9.6/lib/rake/rake_test_loader.rb:4:in `select'
	from /Users/myuser/devel/util/mdless/vendor/bundle/ruby/2.3.0/gems/rake-0.9.6/lib/rake/rake_test_loader.rb:4:in `'
rake aborted!
Command failed with status (1): [ruby -I"lib:test" -I"/Users/myuser/devel/util/mdless/vendor/bundle/ruby/2.3.0/gems/rake-0.9.6/lib" "/Users/myuser/devel/util/mdless/vendor/bundle/ruby/2.3.0/gems/rake-0.9.6/lib/rake/rake_test_loader.rb" "test/default_test.rb" ]
/Users/myuser/.gem/ruby/2.3.0/gems/bundler-2.1.4/lib/bundler/cli/exec.rb:63:in `load'
/Users/myuser/.gem/ruby/2.3.0/gems/bundler-2.1.4/lib/bundler/cli/exec.rb:63:in `kernel_load'
/Users/myuser/.gem/ruby/2.3.0/gems/bundler-2.1.4/lib/bundler/cli/exec.rb:28:in `run'
/Users/myuser/.gem/ruby/2.3.0/gems/bundler-2.1.4/lib/bundler/cli.rb:476:in `exec'
/Users/myuser/.gem/ruby/2.3.0/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/Users/myuser/.gem/ruby/2.3.0/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
/Users/myuser/.gem/ruby/2.3.0/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor.rb:399:in `dispatch'
/Users/myuser/.gem/ruby/2.3.0/gems/bundler-2.1.4/lib/bundler/cli.rb:30:in `dispatch'
/Users/myuser/.gem/ruby/2.3.0/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor/base.rb:476:in `start'
/Users/myuser/.gem/ruby/2.3.0/gems/bundler-2.1.4/lib/bundler/cli.rb:24:in `start'
/Users/myuser/.gem/ruby/2.3.0/gems/bundler-2.1.4/exe/bundle:46:in `block in '
/Users/myuser/.gem/ruby/2.3.0/gems/bundler-2.1.4/lib/bundler/friendly_errors.rb:123:in `with_friendly_errors'
/Users/myuser/.gem/ruby/2.3.0/gems/bundler-2.1.4/exe/bundle:34:in `'
/Users/myuser/.gem/ruby/2.3.0/bin/bundle:22:in `load'
/Users/myuser/.gem/ruby/2.3.0/bin/bundle:22:in `'
Tasks: TOP => default => test
(See full trace by running task with --trace)

I very obviously have the test-unit gem (3.1.5) available as a part of the OS-default Ruby installation:

$ gem which test-unit
/Library/Ruby/Gems/2.3.0/gems/test-unit-3.1.5/lib/test-unit.rb

It's possible I just don't understand Ruby, bundler, or gems, because I don't know why bundle exec wouldn't just use that one.

@ernstki
Copy link
Author

ernstki commented Jan 14, 2020

A workaround is to add gem 'test-unit' to the Gemfile, or add a development dependency to the gemspec file:

sed -i '' "/s.add_development_dependency 'aruba'/a\\
\ \ s.add_development_dependency 'test-unit', '~> 3'\\
" mdless.gemspec

with GNU sed (just plain sed on Linux):

gsed -i "/s.add_development_dependency 'aruba'/a\\
  s.add_development_dependency 'test-unit', '~> 3'" mdless.gemspec

If that's all it takes to satisfactorily fix this (without making anything worse), I'm happy to do a PR with just that change.

@ttscoff
Copy link
Owner

ttscoff commented Jan 15, 2020 via email

@ernstki
Copy link
Author

ernstki commented Jan 15, 2020

If you're happy with your routine doing the manual tests, I respect that. But I'm certainly willing to take those, divide them up into automated tests (including one for #42), and submit a PR. I'll leave the original .md files untouched. Cucumber doesn't look so scary, and I could use some practice with Ruby.

@ttscoff
Copy link
Owner

ttscoff commented Jan 15, 2020 via email

@ernstki
Copy link
Author

ernstki commented Jan 16, 2020

OK!

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

2 participants