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
Method argument replaced by an instance of Minitest::Expectation #521
Comments
There are no direct uses of This specific test file uses assertion style, but there are other files in the suite that use the expectation style. |
OK. Good. Since you're doing assertion-style, please re-run your tests with MT_NO_ISOLATE=1. Something like: rake MT_NO_ISOLATE=1 TESTOPTS="-n /generates a document/" if that works, re-run with MT_NO_ISOLATE again, but without the TESTOPTS, to un-eliminate cross-test contamination. |
I've got a similar issue. I just tried running the tests with Sample console output from a failing test:
Note that the expected values have been replaced with
and the code that's being tested uses the input with Nokogiri and builds some XML output.
|
Running the test by itself with MT_NO_ISOLATE=1 produced the same error. My case is similar to @daxadax. The argument in question is a subclass of OpenStruct. However there is no XML or JSON generation, or parsing, involved. |
Correction: the expected argument in my case is not a subclass of OpenStruct, it is a value from a subclass of OpenStruct. It's the
Syntax::PDF::Stylesheet is the subclass of OpenStruct. |
@ammar, try running with with MT_NO_EXPECTATIONS=1 My colleague (@splattael) helped me to work out the minimum code necessary to generate failure and in the process we discovered that this seems to be related to Minitest::Expectations making an alias for After setting the MT_NO_EXPECTATIONS environment variable, the code runs with no errors as you can see here. |
Ok. Now that we've verified that part, can you chase that down and find a repro? Replacing I think it needs to move to its own module and/or into Spec.
|
@daxadax, running with MT_NO_EXPECTATIONS=1 worked. @zenspider, thanks for the hint. Here's a repro I found after replacing require 'test_helper'
class ValueMonadTest < Minitest::Test
def setup
@struct = OpenStruct.new(_: '_', value: 'VALUE', expect: 'EXPECT')
end
def test_value_monad_method
assert_equal '_', @struct._
end
def test_value_monad_value_alias
assert_equal 'VALUE', @struct.value
end
def test_value_monad_expect_alias
assert_equal 'EXPECT', @struct.expect
end
end |
Fuckin' openstruct... it's always openstruct... ugh. |
Hrm... ok. How about a quick patch: class Object
private :_
end I'm still leaning towards pushing |
The patch worked for class Object
private :_, :value, :expect
end I also ran the whole suite with that patch applied and it passed completely. |
OK. Now that we know what is going on. We need a fix... |
How about something like: https://gist.github.com/473ce2f403d28eb5f46b ? |
That patch did the trick. The repro and the suites from a few different apps all pass as before. Cheers! |
👏 |
Sorry. I committed this a few days ago. I'll release sometime soon. |
Breaks build on CI for some reason See minitest/minitest#521
Encountered after upgrading to minitest 5.6.0.
The following NameError occurs because a method argument is being replaced by an instance of Minitest::Expectation.
The argument in this case is the
options
in the following:The Minitest::Expectation that is replacing the argument is:
The expected argument is:
A gist with the tests in question and test_helper.rb can be found here
The text was updated successfully, but these errors were encountered: