Infinite loop when binding.pry with ci_reporter #490

Closed
bbbco opened this Issue Mar 15, 2012 · 4 comments

Comments

Projects
None yet
3 participants
@bbbco

bbbco commented Mar 15, 2012

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: nicksieger/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 comment has been minimized.

Show comment Hide comment
@envygeeks

envygeeks Mar 15, 2012

Contributor

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.

Contributor

envygeeks commented Mar 15, 2012

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

This comment has been minimized.

Show comment Hide comment
@banister

banister Mar 16, 2012

Owner

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

Owner

banister commented Mar 16, 2012

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

@bbbco

This comment has been minimized.

Show comment Hide comment
@bbbco

bbbco Mar 16, 2012

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

bbbco commented Mar 16, 2012

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

@ghost ghost assigned envygeeks Mar 24, 2012

@banister

This comment has been minimized.

Show comment Hide comment
@banister

banister Mar 28, 2012

Owner

fixed in ci_reporter gem ci-reporter/ci_reporter@e336700

Owner

banister commented Mar 28, 2012

fixed in ci_reporter gem ci-reporter/ci_reporter@e336700

@banister banister closed this Mar 28, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment