Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Python (http://www.velocityreviews.com/forums/f43-python.html)
-   -   Re: unittest - sort cases to be run (http://www.velocityreviews.com/forums/t951181-re-unittest-sort-cases-to-be-run.html)

Terry Reedy 08-21-2012 09:34 AM

Re: unittest - sort cases to be run
 
On 8/21/2012 5:09 AM, Kevin Zhang wrote:
> Hi all,
>
> 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,


Rename it @BTest.

--
Terry Jan Reedy


goon12 08-21-2012 05:27 PM

Re: unittest - sort cases to be run
 
On Tuesday, August 21, 2012 5:34:33 AM UTC-4, Terry Reedy wrote:
> On 8/21/2012 5:09 AM, Kevin Zhang wrote:
>
> > Hi all,

>
> >

>
> > 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,


If BTest *has* to run prior to ATest, it could be a code smell.

goon12 08-21-2012 05:27 PM

Re: unittest - sort cases to be run
 
On Tuesday, August 21, 2012 5:34:33 AM UTC-4, Terry Reedy wrote:
> On 8/21/2012 5:09 AM, Kevin Zhang wrote:
>
> > Hi all,

>
> >

>
> > 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,


If BTest *has* to run prior to ATest, it could be a code smell.


All times are GMT. The time now is 11:34 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.