Nose 0.9: good ideas
Thanks to Mika Eloranta, nose 0.9 will feature a plugin that allows selection of tests to run by introspection of test class, method or function attributes. Here are a few usage examples:
- Simple syntax (-a, --attr) examples:
nosetests -a status=stable
Only test cases with attribute "status" having value "stable"nosetests -a priority=2,status=stable
Both attributes must matchnosetests -a tags=http
Attribute list "tags" must contain value "http"nosetests -a slow
Attribute "slow" must be defined and its value cannot be equal to False (False, [], "", etc...)nosetests -a !slow
Attribute "slow" must NOT be defined or its value must be equal to False
- Eval expression syntax (-A, --eval-attr) examples:
nosetests -A "not slow"nosetests -A "(priority < 5) and not slow"
Quoted expression will be evaluated in the context of each
test case, and only test cases where it evaluates to true
will be selected.
Pretty cool. This is such a good idea, and will be so generally useful, that I think it alone justifies the pluginization of nose. I'm excited to see what other good ideas might be lurking out there, too.
