Google Groups Home
Help | Sign in
Addition for 1.0/Testing#testing-your-model
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  5 messages - Collapse all
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
Doug Latornell  
View profile
 More options Mar 29, 12:48 pm
From: Doug Latornell <djlatorn...@gmail.com>
Date: Sat, 29 Mar 2008 09:48:10 -0700 (PDT)
Local: Sat, Mar 29 2008 12:48 pm
Subject: Addition for 1.0/Testing#testing-your-model
I think it should be noted in the Testing Your Model section of
http://docs.turbogears.org/1.0/Testing that testutil.DBTest provides
setUp() and tearDown() methods that create and drop (respectively) the
tables for your model.  That means that if you want to define your own
setUp/tearDown for tests in a class that inherits from testutil.DBTest
you either need to handle the creates/drops yourself, or do something
like:

def setUp(self):
    testutil.DBTest.setUp(self)
    # the rest of your setup code...

and the same sort of thing for tearDown.

You can see what I mean by simply adding do-nothing setUp/tearDown to
a testutil.DBTest test class:

def setUp(self):
    pass

def tearDown(self):
    pass

Test that previously passed will fail, complaining about non-existent
database tables.

Doug


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Christopher Arndt  
View profile
 More options Mar 30, 8:52 am
From: Christopher Arndt <chris.ar...@web.de>
Date: Sun, 30 Mar 2008 14:52:22 +0200
Local: Sun, Mar 30 2008 8:52 am
Subject: Re: Addition for 1.0/Testing#testing-your-model
Doug Latornell schrieb:

> I think it should be noted in the Testing Your Model section of
> http://docs.turbogears.org/1.0/Testing that testutil.DBTest provides
> setUp() and tearDown() methods that create and drop (respectively) the
> tables for your model.

Does the default implementation support SO and SA or only the former?

>  That means that if you want to define your own
> setUp/tearDown for tests in a class that inherits from testutil.DBTest
> you either need to handle the creates/drops yourself, or do something
> like:

> def setUp(self):
>     testutil.DBTest.setUp(self)
>     # the rest of your setup code...

That should probably be 'super(MyTest, self).setUp()', shouldn't it?

Can you file "Documentation" enhancement ticket please?

Extra karma points for providing a diff for the new text :-)

Chris


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Doug Latornell  
View profile
 More options Mar 31, 1:32 am
From: Doug Latornell <djlatorn...@gmail.com>
Date: Sun, 30 Mar 2008 22:32:35 -0700 (PDT)
Local: Mon, Mar 31 2008 1:32 am
Subject: Re: Addition for 1.0/Testing#testing-your-model
On Mar 30, 5:52 am, Christopher Arndt <chris.ar...@web.de> wrote:

> Doug Latornell schrieb:

> > I think it should be noted in the Testing Your Model section of
> >http://docs.turbogears.org/1.0/Testingthat testutil.DBTest provides
> > setUp() and tearDown() methods that create and drop (respectively) the
> > tables for your model.

> Does the default implementation support SO and SA or only the former?

Certainly SO, but I'm not sure about SA.  I'll try to figure that out
and get back.

> >  That means that if you want to define your own
> > setUp/tearDown for tests in a class that inherits from testutil.DBTest
> > you either need to handle the creates/drops yourself, or do something
> > like:

> > def setUp(self):
> >     testutil.DBTest.setUp(self)
> >     # the rest of your setup code...

> That should probably be 'super(MyTest, self).setUp()', shouldn't it?

Yeah, you're right, that's more correct and idiomatic, though the
other works...

> Can you file "Documentation" enhancement ticket please?

Will do.

> Extra karma points for providing a diff for the new text :-)

I like karma!!  I'll see what I can do.

Doug


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Doug Latornell  
View profile
 More options Apr 29, 12:09 am
From: Doug Latornell <djlatorn...@gmail.com>
Date: Mon, 28 Apr 2008 21:09:31 -0700 (PDT)
Local: Tues, Apr 29 2008 12:09 am
Subject: Re: Addition for 1.0/Testing#testing-your-model
Finally got some time in on this - sorry for taking so long.

The default implementation supports only SO.  The only SA support I
can see in testutil is the sqlalchemy_cleanup() method.

I've created http://trac.turbogears.org/ticket/1814 which includes a
patch that I hope clarifies the setUp/tearDown methods operation, and
explains how to augment them with one's own setUp/tearDown code.

Doug


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Christopher Arndt  
View profile
 More options Apr 29, 2:44 pm
From: Christopher Arndt <chris.ar...@web.de>
Date: Tue, 29 Apr 2008 20:44:55 +0200
Local: Tues, Apr 29 2008 2:44 pm
Subject: Re: Addition for 1.0/Testing#testing-your-model
Doug Latornell schrieb:

> Finally got some time in on this - sorry for taking so long.

> The default implementation supports only SO.  The only SA support I
> can see in testutil is the sqlalchemy_cleanup() method.

> I've created http://trac.turbogears.org/ticket/1814 which includes a
> patch that I hope clarifies the setUp/tearDown methods operation, and
> explains how to augment them with one's own setUp/tearDown code.

Thanks, I will look at it tomorrow.

Chris


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google