Saturday, March 18, 2006

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 match
    • nosetests -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.

4 Comments:

Blogger kumar said...

oh yeah, with a nice post-commit hook running the entire suite, this is going to make little changes in my sandbox speedy. (heh, and I can finally put -a !windows to stop some annoying import ODBC errors.)

7:41 PM  
Blogger http://www.usome.com said...

This post has been removed by a blog administrator.

8:57 PM  
Blogger 版主支持你 said...

This post has been removed by a blog administrator.

9:01 AM  
Blogger runescapemoney said...

This post has been removed by a blog administrator.

3:11 AM  

Post a Comment

<< Home