unit test for testing argument parsing in nose plugin

38 views
Skip to first unread message

ali

unread,
Jan 14, 2013, 7:19:11 PM1/14/13
to nose...@googlegroups.com
Hi, 
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.

thanks,
./A

Reply all
Reply to author
Forward
0 new messages