From anuraguniyal at yahoo.com Tue Jul 3 12:53:44 2007 From: anuraguniyal at yahoo.com (anurag uniyal) Date: Tue, 3 Jul 2007 03:53:44 -0700 (PDT) Subject: [py-dev] generative tests : setup/teardown? Message-ID: <527001.60747.qm@web37307.mail.mud.yahoo.com> Hi, I have just changed our testing framework from PyUnit to py.tests and so I am very new to it. I was trying to write some generative tests so that my mutiple tests can be easily generated as they differ only by few parameters. It works fine except that it seem generative tests are not treated equal to normal tests (test_*) because setup_method is not called every time for each generated tests and that makes it impossible for me to use generative tests in my case. Is it expected behaviour? what is the alternative? Thanks and Regards Anurag ____________________________________________________________________________________ Get your own web address. Have a HUGE year through Yahoo! Small Business. http://smallbusiness.yahoo.com/domains/?p=BESTDEAL From holger at merlinux.de Tue Jul 3 13:09:36 2007 From: holger at merlinux.de (holger krekel) Date: Tue, 3 Jul 2007 13:09:36 +0200 Subject: [py-dev] generative tests : setup/teardown? In-Reply-To: <527001.60747.qm@web37307.mail.mud.yahoo.com> References: <527001.60747.qm@web37307.mail.mud.yahoo.com> Message-ID: <20070703110936.GG4574@solar.trillke> Hi Anurag! On Tue, Jul 03, 2007 at 03:53 -0700, anurag uniyal wrote: > Hi, > > I have just changed our testing framework from PyUnit to py.tests and so I am very new to it. > > I was trying to write some generative tests so that my mutiple tests can be easily generated as they differ only by few parameters. > It works fine except that it seem generative tests are not treated equal to normal tests (test_*) > because setup_method is not called every time for each generated tests and that makes it impossible for me to use generative tests in my case. > > Is it expected behaviour? what is the alternative? it's known and expected behaviour. The setup/teardown mechanics apply to the generator which yields/generates the actual test functions/params. However, you might call setup/teardown methods directly from the generated tests. Find below a code example which you can run with "py.test test_gensetup.py" if you write it to a file. hope it helps. best, holger ---- test_gensetup.py ---- def mysetup(para): print "mysetup gentest", para def myteardown(para): print "myteardown gentest", para def gentest(para): assert 4 == para def gentestwrapper(para): mysetup(para) # could also call existing setup_function()/setup_method() try: gentest(para) finally: myteardown(para) def test_generated(): for x in 1,2,3: yield gentestwrapper, x From anuraguniyal at yahoo.com Tue Jul 3 13:29:13 2007 From: anuraguniyal at yahoo.com (anurag uniyal) Date: Tue, 3 Jul 2007 04:29:13 -0700 (PDT) Subject: [py-dev] generative tests : setup/teardown? Message-ID: <12187.29056.qm@web37304.mail.mud.yahoo.com> Thanks for the code. I am doing similar thing, only thing is setup is called twice which is not a problem though. rgds Anurag ----- Original Message ---- From: holger krekel To: anurag uniyal Cc: py-dev at codespeak.net Sent: Tuesday, July 3, 2007 4:39:36 PM Subject: Re: [py-dev] generative tests : setup/teardown? Hi Anurag! On Tue, Jul 03, 2007 at 03:53 -0700, anurag uniyal wrote: > Hi, > > I have just changed our testing framework from PyUnit to py.tests and so I am very new to it. > > I was trying to write some generative tests so that my mutiple tests can be easily generated as they differ only by few parameters. > It works fine except that it seem generative tests are not treated equal to normal tests (test_*) > because setup_method is not called every time for each generated tests and that makes it impossible for me to use generative tests in my case. > > Is it expected behaviour? what is the alternative? it's known and expected behaviour. The setup/teardown mechanics apply to the generator which yields/generates the actual test functions/params. However, you might call setup/teardown methods directly from the generated tests. Find below a code example which you can run with "py.test test_gensetup.py" if you write it to a file. hope it helps. best, holger ---- test_gensetup.py ---- def mysetup(para): print "mysetup gentest", para def myteardown(para): print "myteardown gentest", para def gentest(para): assert 4 == para def gentestwrapper(para): mysetup(para) # could also call existing setup_function()/setup_method() try: gentest(para) finally: myteardown(para) def test_generated(): for x in 1,2,3: yield gentestwrapper, x ____________________________________________________________________________________ Pinpoint customers who are looking for what you sell. http://searchmarketing.yahoo.com/ From holger at merlinux.de Wed Jul 11 07:56:10 2007 From: holger at merlinux.de (holger krekel) Date: Wed, 11 Jul 2007 07:56:10 +0200 Subject: [py-dev] website problems? Message-ID: <20070711055610.GP4574@solar.trillke> Hi folks, as i am at the EuroPython conference i don't really have the focus to check up on the below potential py lib web site issues. could somebody take a look, verify and analyze the problem? thanks & best, holger ----- Forwarded message from Wolfgang Langner ----- Date: Tue, 10 Jul 2007 09:50:50 +0200 From: Wolfgang Langner To: holger krekel Subject: Re: py.test download link broken X-Spambayes-Classification: ham; 0.00 Good morning, the following URL's are not accessible for me: http://codespeak.net/py/dist/apigen/source/index.html http://codespeak.net/py/dist/contact.html http://codespeak.net/py/dist/download.html I get no page if I try to access them. Because I can't access the download page it is not possible to test the download links to the files. I don't now them. I downloaded the release from subversion directly. But it only occurs with Firefox (under Windows, Version 2.0.0.4). Opera and IE works fine. Strange problem. With Firefox I get the following Error in Console for page http://codespeak.net/py/dist/: Warning: Error in parsing value for property 'padding'. Declaration dropped. Source File: http://codespeak.net/py/dist/style.css Line: 448 For the other pages I get nothing. I hope it is not a configuration Problem with my browser settings. For testing I disabled all extensions. bye by Wolfgang ----- End forwarded message ----- -- merlinux GmbH Steinbergstr. 42 31139 Hildesheim http://merlinux.de tel +49 5121 20800 75 (fax 77) From joe at merlinux.de Wed Jul 11 08:37:30 2007 From: joe at merlinux.de (Martin Pajak) Date: Wed, 11 Jul 2007 08:37:30 +0200 Subject: [py-dev] website problems? In-Reply-To: <20070711055610.GP4574@solar.trillke> References: <20070711055610.GP4574@solar.trillke> Message-ID: <46947AAA.1030003@merlinux.de> Hello, I checked the links with my firefox 2.0.0.4 on Windows XP and got all the pages displayed. I also could use the download links, so I can't verify the problems mentioned by Wolfgang. Martin holger krekel schrieb: > Hi folks, > > as i am at the EuroPython conference i don't really have > the focus to check up on the below potential py lib web site > issues. could somebody take a look, verify and analyze > the problem? > > thanks & best, > > holger > > ----- Forwarded message from Wolfgang Langner ----- > > Date: Tue, 10 Jul 2007 09:50:50 +0200 > From: Wolfgang Langner > To: holger krekel > Subject: Re: py.test download link broken > X-Spambayes-Classification: ham; 0.00 > > Good morning, > > the following URL's are not accessible for me: > > http://codespeak.net/py/dist/apigen/source/index.html > http://codespeak.net/py/dist/contact.html > http://codespeak.net/py/dist/download.html > > I get no page if I try to access them. Because I can't access the > download page it is not possible to test the download links to the > files. I don't now them. > I downloaded the release from subversion directly. > > But it only occurs with Firefox (under Windows, Version 2.0.0.4). > Opera and IE works fine. Strange problem. > > With Firefox I get the following Error in Console for page > http://codespeak.net/py/dist/: > Warning: Error in parsing value for property 'padding'. Declaration dropped. > Source File: http://codespeak.net/py/dist/style.css > Line: 448 > > For the other pages I get nothing. > > I hope it is not a configuration Problem with my browser settings. > For testing I disabled all extensions. > > bye by > > Wolfgang > > > ----- End forwarded message ----- > From brian at dorseys.org Wed Jul 11 09:39:17 2007 From: brian at dorseys.org (Brian Dorsey) Date: Wed, 11 Jul 2007 00:39:17 -0700 Subject: [py-dev] website problems? In-Reply-To: <46947AAA.1030003@merlinux.de> References: <20070711055610.GP4574@solar.trillke> <46947AAA.1030003@merlinux.de> Message-ID: <66e877b70707110039l1b47afabm8f971a49e829b54f@mail.gmail.com> On 7/10/07, Martin Pajak wrote: > I checked the links with my firefox 2.0.0.4 on Windows XP and got all > the pages displayed. I also could use the download links, so I can't > verify the problems mentioned by Wolfgang. Same here. I'm able to hit all of the links (same version of firefox and windows). No errors on the dist page. I have a lot of extensions installed. Take care, -Brian