Former-commit-id:06a8b51d6d
[formerly9f19e3f712
[formerly 64fa9254b946eae7e61bbc3f513b7c3696c4f54f]] Former-commit-id:9f19e3f712
Former-commit-id:a02aeb236c
45 lines
1.4 KiB
Python
Executable file
45 lines
1.4 KiB
Python
Executable file
import unittest
|
|
from nose.plugins.base import IPluginInterface
|
|
|
|
class TestPluginInterfaces(unittest.TestCase):
|
|
|
|
def test_api_methods_present(self):
|
|
|
|
from nose.loader import TestLoader
|
|
from nose.selector import Selector
|
|
|
|
|
|
exclude = [ 'loadTestsFromGenerator',
|
|
'loadTestsFromGeneratorMethod'
|
|
]
|
|
|
|
selfuncs = [ f for f in dir(Selector)
|
|
if f.startswith('want') ]
|
|
loadfuncs = [ f for f in dir(TestLoader)
|
|
if f.startswith('load') and not f in exclude ]
|
|
|
|
others = ['addDeprecated', 'addError', 'addFailure',
|
|
'addSkip', 'addSuccess', 'startTest', 'stopTest',
|
|
'prepareTest', 'begin', 'report'
|
|
]
|
|
|
|
expect = selfuncs + loadfuncs + others
|
|
|
|
pd = dir(IPluginInterface)
|
|
|
|
for f in expect:
|
|
assert f in pd, "No %s in IPluginInterface" % f
|
|
assert getattr(IPluginInterface, f).__doc__, \
|
|
"No docs for %f in IPluginInterface" % f
|
|
|
|
def test_no_instantiate(self):
|
|
try:
|
|
p = IPluginInterface()
|
|
except TypeError:
|
|
pass
|
|
else:
|
|
assert False, \
|
|
"Should not be able to instantiate IPluginInterface"
|
|
|
|
if __name__ == '__main__':
|
|
unittest.main()
|