Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Infinite loop when binding.pry with ci_reporter #490

Closed
bbbco opened this Issue · 4 comments

3 participants

@bbbco

I am writing some webdriver tests, and have been using pry to step into my tests in order to debug, test, and continue to develop these tests. We recently integrated ci_reporter into our TestUnit framework, which allows us to easily generate an xml results file to hand over to our CI system. Interestingly enough, when ci_reporter is loaded, and the binding.pry is referenced inside one of my methods, upon accessing this command my prompt is stuck in an infinite loop:

TypeError: wrong argument type CI::Reporter::OutputCapture (expected File)
from /home/brian/.rvm/gems/ree-1.8.7-2012.02@reverbnation/gems/pry-0.9.8.2/lib/pry/pry_instance.rb:525:in `readline'

I opened an issue with the ci_reporter developer here: ci-reporter/ci_reporter#55 and he indicates that "ci_reporter overrides and wraps $stdout and $stderr". He wonders if pry is expecting too strict of an instance of File? I was able to get around the issue by returning $stdout, $stderr = STDOUT, STDERR

Any ideas?

@envygeeks

This is something me and @conradirwin talked about last night, not directly related to this issue but related to other issues that have the same sort of problem. The consensus right now is that we will set our $stdout and $stdin and $stderr unless the user explicitly passes $stdin and $stdout and I'm thinking that we should reset it at the end of our exit.

@banister
Owner

@bbbco would you be able to create a simple test case for me to play with?

@bbbco
require "rubygems"
require "test/unit"
require "pry"
#require 'ci/reporter/rake/test_unit_loader'

class SimpleTest < Test::Unit::TestCase

  def test_simpletest
    @a = 5
    @b = 7
    assert_equal(35, @a*@b)
    binding.pry
    assert_equal(12, @a+@b)
  end

end

Just run the test once to verify the pry bindings work, then uncomment the require 'ci/reporter/rake/test_unit_loader' line and run again to see the infinite loop.

Also, I think it goes without saying to install the gems first, most specifically gem install ci_reporter

@envygeeks envygeeks was assigned
@banister
Owner

fixed in ci_reporter gem ci-reporter/ci_reporter@e336700

@banister banister closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.