awips2/pythonPackages/nose/unit_tests/test_plugin_interfaces.py
root e2ecdcfe33 Initial revision of AWIPS2 11.9.0-7p5
Former-commit-id: a02aeb236c [formerly 9f19e3f712] [formerly a02aeb236c [formerly 9f19e3f712] [formerly 06a8b51d6d [formerly 64fa9254b946eae7e61bbc3f513b7c3696c4f54f]]]
Former-commit-id: 06a8b51d6d
Former-commit-id: 8e80217e59 [formerly 3360eb6c5f]
Former-commit-id: 377dcd10b9
2012-01-06 08:55:05 -06:00

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()