##// END OF EJS Templates
Add a workaround for a nose problem so the test suite runs with nose 0.11.x
Fernando Perez -
Show More
@@ -439,7 +439,29 b' class DocTestCase(doctests.DocTestCase):'
439 _ip.IP.user_ns.update(self._dt_test.globs)
439 _ip.IP.user_ns.update(self._dt_test.globs)
440 self._dt_test.globs = _ip.IP.user_ns
440 self._dt_test.globs = _ip.IP.user_ns
441
441
442 doctests.DocTestCase.setUp(self)
442 super(DocTestCase, self).setUp()
443
444 def tearDown(self):
445 # XXX - fperez: I am not sure if this is truly a bug in nose 0.11, but
446 # it does look like one to me: its tearDown method tries to run
447 #
448 # delattr(__builtin__, self._result_var)
449 #
450 # without checking that the attribute really is there; it implicitly
451 # assumes it should have been set via displayhook. But if the
452 # displayhook was never called, this doesn't necessarily happen. I
453 # haven't been able to find a little self-contained example outside of
454 # ipython that would show the problem so I can report it to the nose
455 # team, but it does happen a lot in our code.
456 #
457 # So here, we just protect as narrowly as possible by trapping an
458 # attribute error whose message would be the name of self._result_var,
459 # and letting any other error propagate.
460 try:
461 super(DocTestCase, self).tearDown()
462 except AttributeError, exc:
463 if exc.message != self._result_var:
464 raise
443
465
444
466
445 # A simple subclassing of the original with a different class name, so we can
467 # A simple subclassing of the original with a different class name, so we can
General Comments 0
You need to be logged in to leave comments. Login now