Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #27590 > unrolled thread
| Started by | Peter Otten <__peter__@web.de> |
|---|---|
| First post | 2012-08-21 20:00 +0200 |
| Last post | 2012-08-21 20:00 +0200 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: unittest - sort cases to be run Peter Otten <__peter__@web.de> - 2012-08-21 20:00 +0200
| From | Peter Otten <__peter__@web.de> |
|---|---|
| Date | 2012-08-21 20:00 +0200 |
| Subject | Re: unittest - sort cases to be run |
| Message-ID | <mailman.3616.1345572043.4697.python-list@python.org> |
Kevin Zhang wrote: > I want to sort the order of the unittest cases to be run, but found such > statement in Python doc, > "Note that the order in which the various test cases will be run is > determined by sorting the test function names with respect to the built-in > ordering for strings." > > s.addTest(BTest()) > s.addTest(ATest()) > TextTestRunner().run(ts) > > I need BTest() to be run prior to ATest(), is there any natural/beautiful > way to achieve this? Thanks, Did you try the above? I think BTest *will* run before ATest. The sorting is performed by the TestLoader if there is one, i. e. if you don't build a test suite manually. If you *do* use a TestLoader you can still influence the sort order by defining a sortTestMethodsUsing static method. Here's a fairly complex example: [Ordering tests in a testsuite] http://mail.python.org/pipermail/python-list/2010-October/589058.html
Back to top | Article view | comp.lang.python
csiph-web