Skip to content

Commit

Permalink
stop suppressing addError on SkipTest and DeprecatedTest
Browse files Browse the repository at this point in the history
ErrorClass returns True on addError to prevent SkipTest and
DeprecatedTest from getting to the pdb plugin. However this prevents
all plugins from getting them, and the documentation specifies that
these exceptions should get to the plugins. The pdb plugin should handle
these exceptions explicitly as the documentation suggests.
This also deprecates Google Code Issue nose-devs#101 so there is nothing to test
there anymore.
This fixes nose-devs#45.
  • Loading branch information
wiggin15 committed Apr 8, 2013
1 parent d83d279 commit 65c611a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 36 deletions.
13 changes: 13 additions & 0 deletions nose/plugins/debug.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

import pdb
from nose.plugins.base import Plugin
from nose.util import isclass
from nose.plugins.skip import SkipTest
from nose.plugins.deprecated import DeprecatedTest

class Pdb(Plugin):
"""
Expand Down Expand Up @@ -37,16 +40,26 @@ def configure(self, options, conf):
self.enabled_for_errors = options.debugErrors
self.enabled_for_failures = options.debugFailures

def _filterError(self, err):
if isinstance(err, tuple) and isclass(err[0]):
if issubclass(err[0], SkipTest) or issubclass(err[0], DeprecatedTest):
return True
return False

def addError(self, test, err):
"""Enter pdb if configured to debug errors.
"""
if self._filterError(err):
return
if not self.enabled_for_errors:
return
self.debug(err)

def addFailure(self, test, err):
"""Enter pdb if configured to debug failures.
"""
if self._filterError(err):
return
if not self.enabled_for_failures:
return
self.debug(err)
Expand Down
9 changes: 0 additions & 9 deletions nose/plugins/errorclass.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@
from nose.pyversion import make_instancemethod
from nose.plugins.base import Plugin
from nose.result import TextTestResult
from nose.util import isclass

class MetaErrorClass(type):
"""Metaclass for ErrorClassPlugins that allows error classes to be
Expand Down Expand Up @@ -136,14 +135,6 @@ class ErrorClassPlugin(Plugin):
score = 1000
errorClasses = ()

def addError(self, test, err):
err_cls, a, b = err
if not isclass(err_cls):
return
classes = [e[0] for e in self.errorClasses]
if filter(lambda c: issubclass(err_cls, c), classes):
return True

def prepareTestResult(self, result):
if not hasattr(result, 'errorClasses'):
self.patchResult(result)
Expand Down
27 changes: 0 additions & 27 deletions unit_tests/test_issue_101.py

This file was deleted.

0 comments on commit 65c611a

Please sign in to comment.