Sun Mar 12 14:01:49 2006
Ticket #12 (Closed: fixed)
patch: attribute-based test case selector
| Priority: | normal | Reporter: | guest |
|---|---|---|---|
| Severity: | normal | Assigned to: | jpellerin |
| Component: | nose | Status: | closed |
| Version: | 0.9a1 | Resolution: | fixed |
| Milestone: | 0.9a1 | Keywords: |
Description by guest:
This patch adds selecting test cases based on their attributes.
Examples of test function/method attribute usage with patched nose
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" (see test_foobar() below for definition)
- nosetests -a slow => attribute "slow" must be defined and its value cannot 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"
This example and the accompanied patch is in public domain, free for any use.
Attachments
Changelog
Sun Mar 12 14:02:14 2006: Modified by guest
- attachment added: patch-r6
Sun Mar 12 14:02:51 2006: Modified by guest
- attachment added: test_noseattribs.py
Tue Mar 14 22:36:13 2006: Modified by jpellerin
- resolution set to fixed
- milestone set to 0.9a1
- version set to 0.9a1
- status changed from new to closed

Applied (with some small changes) in [7]. Thanks!