This is a nose plugin that allows you to add special switches in code, based on options set when running nose tests.
For calling the plugin, use any of the following:
$ nosetests -S <switch_string>
$ nosetests -S<switch_string>
$ nosetests --switch=<switch_string>
$ nosetests --switch <switch_string>
- import package into project:
from nose_switch import *
- now, you can use the switch_on(string) method, which returns True or False, if that string was used as a parameter when running the tests:
nose_switch.switch_on('debug') # returns True or False
- when running the tests, use:
$ nosetests -S debug
- you can also add multiple switches:
$ nosetests -S sw1 -S sw2 -S sw3