-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Improve Puma::NullIO consistency with real IO #3276
Conversation
Thanks for the PR. Five of the tests fail when only the test changes are added to master. LGTM. Any thoughts on the below, which removes two asserts inside of diff --git a/test/test_null_io.rb b/test/test_null_io.rb
index a3b2a2b5..dd86ffc8 100644
--- a/test/test_null_io.rb
+++ b/test/test_null_io.rb
@@ -77,11 +77,11 @@ class TestNullIO < Minitest::Test
assert_includes error.message, "no implicit conversion of Object into String"
error = assert_raises TypeError do
- assert_equal "", nio.read(0, Object.new)
+ nio.read(0, Object.new)
end
error = assert_raises TypeError do
- assert_nil nio.read(1, Object.new)
+ nio.read(1, Object.new)
end
assert_includes error.message, "no implicit conversion of Object into String"
end
@@ -133,7 +133,7 @@ end
# ensure all the test behavior is accurate
class TestNullIOConformance < TestNullIO
def setup
- self.nio = ::Tempfile.new
+ self.nio = ::Tempfile.create
nio.sync = true
end
@@ -141,4 +141,10 @@ class TestNullIOConformance < TestNullIO
self.nio = StringIO.new
super
end
+
+ def teardown
+ return unless nio.is_a? ::File
+ nio.close
+ File.unlink nio.path
+ end
end |
Yup oversight on my part. Thanks for catching it. |
This isn't a big deal, but every small difference has a chance to let a bug slip as it's likely not every scenario is tested with both NullIO and a real IO.
081332c
to
15bbb15
Compare
PR updated. |
@casperisfine Thanks again for the PR. As you stated "but every small difference has a chance to let a bug slip" |
Oversights. I always work locally with Ruby head builds, as I feel I should 'walk what I talk'. A few tests check the response for a frozen IO, which should raise My mistake. Note to self - always review the CI. <Rant on> why are we supporting four EOL Ruby versions? <Rant off> I'll fix... |
I'm working on a fix, some non-MRI errors also. I'm not going to start on the EOL Ruby thing.
I don't think it's fair to expect anyone to remember that. I certainly didn't. |
This isn't a big deal, but every small difference has a chance to let a bug slip as it's likely not every scenario is tested with both NullIO and a real IO. Co-authored-by: Jean Boussier <jean.boussier@gmail.com>
This isn't a big deal, but every small difference has a chance to let a bug slip as it's likely not every scenario is tested with both NullIO and a real IO. Co-authored-by: Jean Boussier <jean.boussier@gmail.com>
This isn't a big deal, but every small difference has a chance to let a bug slip as it's likely not every scenario is tested with both NullIO and a real IO. Co-authored-by: Jean Boussier <jean.boussier@gmail.com>
This isn't a big deal, but every small difference has a chance to let a bug slip as it's likely not every scenario is tested with both NullIO and a real IO.