I'm trying to write some unit tests to validate the arguments that a plugin should / shouldn't accept. As an example I have the following:
import nose.plugins
import unittest
class SimplePlugin(nose.plugins.Plugin):
name = "simple-plugin"
def options(self, parser, env):
super(SimplePlugin, self).options(parser, env)
parser.add_option("--some-number", dest="number", type = "choice", choices=[1,2,3])
class TestSimplePlugin(nose.plugins.PluginTester,unittest.TestCase):
activate = "--with-simple-plugin"
plugins = [ SimplePlugin() ]
args = ["--some-number=10"]
def test(self):
pass
def makeSuite(self):
class TC(unittest.TestCase):
def runTest(self):
pass
When the above is run, the argument passing does indeed raise an error, but I'm not sure what the correct way to capture these errors and assert on them is.