Re: unittest - sort cases to be run

Discussion in 'Python' started by Terry Reedy, Aug 21, 2012.

  1. Terry Reedy

    Terry Reedy Guest

    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
     
    Terry Reedy, Aug 21, 2012
    #1
    1. Advertising

  2. Terry Reedy

    goon12 Guest

    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, Aug 21, 2012
    #2
    1. Advertising

  3. Terry Reedy

    goon12 Guest

    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, Aug 21, 2012
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Scott David Daniels

    Failing unittest Test cases

    Scott David Daniels, Jan 9, 2006, in forum: Python
    Replies:
    18
    Views:
    531
    Scott David Daniels
    Jan 13, 2006
  2. Terry

    ignored test cases in unittest

    Terry, Aug 16, 2009, in forum: Python
    Replies:
    3
    Views:
    355
    David House
    Aug 17, 2009
  3. Replies:
    9
    Views:
    142
    Eric Hodel
    Nov 15, 2005
  4. Peter Otten

    Re: unittest - sort cases to be run

    Peter Otten, Aug 21, 2012, in forum: Python
    Replies:
    0
    Views:
    165
    Peter Otten
    Aug 21, 2012
  5. jitendra gupta
    Replies:
    0
    Views:
    108
    jitendra gupta
    Mar 8, 2013
Loading...

Share This Page