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

Avoid showing "@ rb_sysopen" noise for Ruby 2.4. #1080

Merged
merged 1 commit into from Feb 26, 2017

Conversation

junaruga
Copy link
Contributor

@junaruga junaruga commented Feb 15, 2017

Summary

This fixes #1071.

Details

This issue happens for only Ruby 2.4.0.

Motivation and Context

Want to pass tests.

How Has This Been Tested?

$ ruby -v
ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-linux]

$ bundle exec rake spec
...
568 examples, 0 failures

$ bundle exec rake cucumber
...
207 scenarios (17 failed, 190 passed)
1217 steps (17 failed, 1200 passed)

There are still failed tests. But they will be fixed by #1079 .
The rb_sysopen message was disappeared.

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • I've added tests for my code
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

include FixRuby21Bug9285 if Cucumber::RUBY_2_1 || Cucumber::RUBY_2_2 || Cucumber::RUBY_2_3
class FeatureFolderNotFoundException < Exception
attr :path
def initialize(path)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need a getter for path variable here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nodo I thought previously FeatureFolderNotFoundException had the getter for path variable, because it had extended FileException. But as we do not use the getter right now, removing it might be better. I am going to remove it.

attr :path
def initialize(path)
super('No such file or directory - features')
@path = path
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of calling super, I would suggest to override message method and output the path related to the error. E.g. "Feature folder not found at #{@path}" or similar. If we follow this path I would also use File.expand_path(path) for clarity.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nodo ok I will follow your way.

@@ -14,6 +14,7 @@ module Cucumber
RUBY_2_2 = RUBY_VERSION =~ /^2\.2/
RUBY_2_1 = RUBY_VERSION =~ /^2\.1/
RUBY_2_3 = RUBY_VERSION =~ /^2\.3/
RUBY_2_4 = RUBY_VERSION =~ /^2\.4/

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need these constants at all? /cc @mattwynne @brasmusson

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this PR removes the only usage, so I'd say we can remove them.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @mattwynne 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nodo ok I will remove them 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this PR removes the only usage,

I am still not sure above point. actually this PR can remove these constants?
or this PR should not touch these constants?

The constants RUBY_2_* are used in gem_tasks/cucumber.rake.

$ grep -r RUBY_2_ *
gem_tasks/cucumber.rake:                   elsif Cucumber::RUBY_2_0
gem_tasks/cucumber.rake:                   elsif Cucumber::RUBY_2_1
lib/cucumber/runtime.rb:    include FixRuby21Bug9285 if Cucumber::RUBY_2_1 || Cucumber::RUBY_2_2 || Cucumber::RUBY_2_3
lib/cucumber/platform.rb:    RUBY_2_2      = RUBY_VERSION =~ /^2\.2/
lib/cucumber/platform.rb:    RUBY_2_1      = RUBY_VERSION =~ /^2\.1/
lib/cucumber/platform.rb:    RUBY_2_3      = RUBY_VERSION =~ /^2\.3/

@nodo
Copy link
Member

nodo commented Feb 15, 2017

Thanks @junaruga - just added a couple of comments.

@junaruga
Copy link
Contributor Author

@nodo ok, let me check your coments later. Thanks.

@junaruga
Copy link
Contributor Author

@nodo wait a moment. I will check it today or tomorrow as right now I am busy.

@nodo
Copy link
Member

nodo commented Feb 16, 2017

@junaruga no problem at all. Thanks for working on this!

@junaruga junaruga force-pushed the feature/fix-rb_sysopen-on-ruby-2.4 branch from a0b1484 to a0ce155 Compare February 18, 2017 13:15
@junaruga
Copy link
Contributor Author

junaruga commented Feb 18, 2017

@nodo I modified my code and did rebase after review.
You can check the result on Travis too.

@junaruga junaruga force-pushed the feature/fix-rb_sysopen-on-ruby-2.4 branch from a0ce155 to c323c79 Compare February 18, 2017 13:32
@@ -9,7 +9,7 @@ Feature: Getting started
When I run `cucumber`
Then it should fail with:
"""
No such file or directory - features. You can use `cucumber --init` to get started.
Feature folder not found at
"""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this message should be more detailed. Some possible solutions:

  1. Use Aruba.config.root_directory and somehow use it in the string
  2. Change the exception to report a relative path and not a absolute path (so that here we can write tmp/features
  3. Change the exception to not report the path

Sorry for this, I haven't notice this test before. However, I think it's important to keep it as informative as possible.

What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nodo I like kind of 2. "kind of 2" means when I removed "File.expand_path", I did not need to add `tmp/features' to features/docs/getting_started.feature. Check my additional commit, I am going to push it right now.

I prefer File.expand_path.
But I like you would add File.expand_path by yourself later, if you need it.
Because right now I want to pass all the tests on Ruby 2.4.0.

@voxik
Copy link
Contributor

voxik commented Feb 23, 2017

The error message "Feature folder not found at features.", which is default output with this patch applied, is more confusing then helpful IMO. It is hardly obvious that the "features" refers to folder. If there was the dash as there used to be, that would be a bit better probably ....

@junaruga junaruga force-pushed the feature/fix-rb_sysopen-on-ruby-2.4 branch from 40b6b10 to 6f4be0a Compare February 23, 2017 15:01
@junaruga
Copy link
Contributor Author

@nodo I changed and did rebase of my code. I do not change the message by myself on this PR.
I did not make it worse from current state for this PR. Maybe.

I like you will merge this, and ask you to improve the message by yourself after this PR as you like.

@junaruga
Copy link
Contributor Author

junaruga commented Feb 23, 2017

@nodo I can tell you other options too.

  • You can send your additional code to my repo https://github.com/junaruga/cucumber-ruby branch: feature/fix-rb_sysopen-on-ruby-2.4 as a pull-request. I am going to accept your any code.
  • You can close this pull-request. and you can fix it by yourself.

It does not matter for me. You can make a choice.

@nodo
Copy link
Member

nodo commented Feb 23, 2017

@junaruga sorry for not being responsive. I will check this PR as soon as possible. Thanks for your patience and for your work. Your changes looks good to me, I will just check the message as suggested by @voxik.

@nodo nodo merged commit 552c6e6 into cucumber:master Feb 26, 2017
@junaruga
Copy link
Contributor Author

@nodo Thank you!!

@lock
Copy link

lock bot commented Oct 25, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Oct 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

features/docs/getting_started.feature:7 fails on Ruby 2.4.
4 participants