[pytest-dev] Questions about paramtrize and csv files

Thomas CARPENTIER carpentier.th at gmail.com
Thu Apr 18 12:19:40 CEST 2013


Hi Holger,


here you can find my code : http://pastebin.com/fmitjbw2

and here the csv : http://pastebin.com/UHv2XPt5

the tracebacks : http://pastebin.com/E5p3tLCR

thanks.




---------------------
Thomas CARPENTIER
155 Rue Fleury
92140 CLAMART

Tel : 06.18.09.10.97
Mail : carpentier.th at gmail.com



On Thu, Apr 18, 2013 at 11:35 AM, holger krekel <holger at merlinux.eu> wrote:

> hi Thomas,
>
> On Thu, Apr 18, 2013 at 11:24 +0200, Thomas CARPENTIER wrote:
> > Hi,
> >
> > I'm working with pytest since few weeks now for automate my functionnal
> > tests using Webdriver and python. And i have some questions about how to
> > paramatrize tests.
> >
> > After reading docs, i've setup my tests like :
> >
> > @pytest.mark.parametrize(("Url", "name", "LastName", "IdCustomer"), [
> >  ("http://myurl.com", "myname", "mylastname", "12345"),
> > ])
> > def test_get_infos_about_client(Url, name, Lastname, IdCustomer):
> >     #Do something with arguments
> >     [...]
> >
> >
> > My problem is I've 2 testing environnements ENV1 and ENV2, however datas
> (
> > in particular IdCustomer  are not the same between ENV1 and ENV2 ( these
> > datas are generated during the creation of the Customer)
> >
> > So , I'm thinking about use csv files to inject datas in place of
> > parametrize function. But I did'nt find any docs about it. Is it
> possible?
> >
> > I've tried
> >
> > def pytest_generate_tests(metafunc):
> >     #read csv file
> >     metafunc.parametrize(header, datas)
> >
> > But it doesn't work!
> >
> > Can I do the same thing with another method ?
>
>
> usually pytest_generate_tests is the right place to perform
> config-dependent parametrization.  Could you post what you
> tried there concretely including failure tracebacks?
>
> holger
>
>
> > Thnaks for your help
> >
> >
> > Thomas
>
> > _______________________________________________
> > Pytest-dev mailing list
> > Pytest-dev at python.org
> > http://mail.python.org/mailman/listinfo/pytest-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pytest-dev/attachments/20130418/15e60498/attachment.html>


More information about the Pytest-dev mailing list