You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm running a test suite, and after every test method I'm running a leakchecker in a hook. It checks for various leaks like threads not being joined, etc. I recently added a checker for checking that BasicObject, Kernel and Object don't have new methods added on to them (I eagerly require all libraries that alter these classes, like yaml libraries etc to not get false positives).
When using minitest stubs, there's the following problem:
require'minitest'require'minitest/mock'classMyTest < Minitest::Testdeftest_exampleputsKernel.private_methods(false).grep(/gem/).inspect# []Kernel.stub(:gem,proc{})doendputsKernel.private_methods(false).grep(/gem/).inspect# [:gem]. I would expect this to be empty.# The method is now defined on Kernel's metaclass (a class method). Before it was only an instance method of Kernel.endendMinitest.autorun
So my leakchecker reports these as leaks. I would like it if the method lookup for the receiver was the same before and after the stub call.
Edit:
I just took a look at the PRs for this repo and saw #891 could be related to my issue. I have not checked to see if it is a good solution nor have I tried the solution.
The text was updated successfully, but these errors were encountered:
The problem:
I'm running a test suite, and after every test method I'm running a leakchecker in a hook. It checks for various leaks like threads not being joined, etc. I recently added a checker for checking that BasicObject, Kernel and Object don't have new methods added on to them (I eagerly require all libraries that alter these classes, like yaml libraries etc to not get false positives).
When using minitest stubs, there's the following problem:
So my leakchecker reports these as leaks. I would like it if the method lookup for the receiver was the same before and after the
stub
call.Edit:
I just took a look at the PRs for this repo and saw #891 could be related to my issue. I have not checked to see if it is a good solution nor have I tried the solution.
The text was updated successfully, but these errors were encountered: