Merge pull request #11 from alanhamlett/master
return None to not influence a test running
This commit is contained in:
commit
702945e62b
|
@ -150,7 +150,7 @@ class NoseExclude(Plugin):
|
|||
try:
|
||||
cls = get_method_class(meth)
|
||||
except AttributeError:
|
||||
return False
|
||||
return None
|
||||
|
||||
fqn = '%s.%s.%s' % (cls.__module__, cls.__name__, meth.__name__)
|
||||
if fqn in self.exclude_tests:
|
||||
|
|
23
tests.py
23
tests.py
|
@ -224,5 +224,28 @@ class TestNoseExcludeTestModule(PluginTester, unittest.TestCase):
|
|||
def test_tests_excluded(self):
|
||||
assert 'Ran 3 tests' in self.output
|
||||
|
||||
|
||||
class TestNoseDoesNotExcludeTestClass(PluginTester, unittest.TestCase):
|
||||
"""Test nose-exclude tests by class"""
|
||||
|
||||
activate = "--exclude-test=test_dirs.unittest.test"
|
||||
plugins = [NoseExclude()]
|
||||
suitepath = os.path.join(os.getcwd(), 'test_dirs/unittest')
|
||||
|
||||
def setUp(self):
|
||||
def mock_get_method_class(meth):
|
||||
raise AttributeError('foobar')
|
||||
import nose_exclude
|
||||
self.old_get_method_class = nose_exclude.get_method_class
|
||||
nose_exclude.get_method_class = mock_get_method_class
|
||||
super(TestNoseDoesNotExcludeTestClass, self).setUp()
|
||||
|
||||
def tearDown(self):
|
||||
import nose_exclude
|
||||
nose_exclude.get_method_class = self.old_get_method_class
|
||||
|
||||
def test_tests_not_excluded(self):
|
||||
assert 'Ran 3 tests' in self.output
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
|
Loading…
Reference in New Issue