<div dir="ltr">Ok, so my problem is just about generating datas...<div style>Thanks for your help.</div><div style><br></div><div style>Thomas</div></div><div class="gmail_extra"><br clear="all"><div>---------------------<br>
Thomas CARPENTIER<div>155 Rue Fleury</div><div>92140 CLAMART</div><div><br></div><div>Tel : 06.18.09.10.97</div><div>Mail : <a href="http://carpentier.th" target="_blank">carpentier.th</a>@<a href="http://gmail.com" target="_blank">gmail.com</a></div>
<div><br></div></div>
<br><br><div class="gmail_quote">On Thu, Apr 18, 2013 at 1:24 PM, holger krekel <span dir="ltr"><<a href="mailto:holger@merlinux.eu" target="_blank">holger@merlinux.eu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On Thu, Apr 18, 2013 at 12:51 +0200, Thomas CARPENTIER wrote:<br>
> Thanks but I still have the same errors :(<br>
<br>
</div>Here is a simple test module that works:<br>
<br>
def pytest_generate_tests(metafunc):<br>
datas = [("<a href="http://something" target="_blank">http://something</a>", "hello", "world", "123123")] * 44<br>
<div class="im"> metafunc.parametrize(("url", "name", "lastname", "idCustomer"),<br>
datas)<br>
<br>
<br>
</div> def test_data(url, name, lastname, idCustomer):<br>
assert 0, locals()<br>
<br>
This will run 44 tests as expected. And of course you are free to<br>
generate your "datas" in whichever way you like.<br>
<span class="HOEnZb"><font color="#888888"><br>
holger<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
<br>
<br>
<br>
> I will tried something else ....<br>
><br>
> ---------------------<br>
> Thomas CARPENTIER<br>
> 155 Rue Fleury<br>
> 92140 CLAMART<br>
><br>
> Tel : <a href="tel:06.18.09.10.97" value="+33618091097">06.18.09.10.97</a><br>
> Mail : <a href="mailto:carpentier.th@gmail.com">carpentier.th@gmail.com</a><br>
><br>
><br>
><br>
> On Thu, Apr 18, 2013 at 12:34 PM, holger krekel <<a href="mailto:holger@merlinux.eu">holger@merlinux.eu</a>> wrote:<br>
><br>
> > hi Thomas,<br>
> ><br>
> > On Thu, Apr 18, 2013 at 12:19 +0200, Thomas CARPENTIER wrote:<br>
> > > Hi Holger,<br>
> > ><br>
> > ><br>
> > > here you can find my code : <a href="http://pastebin.com/fmitjbw2" target="_blank">http://pastebin.com/fmitjbw2</a><br>
> > ><br>
> > > and here the csv : <a href="http://pastebin.com/UHv2XPt5" target="_blank">http://pastebin.com/UHv2XPt5</a><br>
> > ><br>
> > > the tracebacks : <a href="http://pastebin.com/E5p3tLCR" target="_blank">http://pastebin.com/E5p3tLCR</a><br>
> > ><br>
> > > thanks.<br>
> ><br>
> > If those 44 "datas" rows each contain 4-tuples you can just call<br>
> ><br>
> > metafunc.parametrize(("url", "name", "lastname", "idCustomer"), datas)<br>
> ><br>
> > The extra [] list around "datas" leads to the error.<br>
> ><br>
> > holger<br>
> ><br>
> > ><br>
> > ><br>
> > ><br>
> > > ---------------------<br>
> > > Thomas CARPENTIER<br>
> > > 155 Rue Fleury<br>
> > > 92140 CLAMART<br>
> > ><br>
> > > Tel : <a href="tel:06.18.09.10.97" value="+33618091097">06.18.09.10.97</a><br>
> > > Mail : <a href="mailto:carpentier.th@gmail.com">carpentier.th@gmail.com</a><br>
> > ><br>
> > ><br>
> > ><br>
> > > On Thu, Apr 18, 2013 at 11:35 AM, holger krekel <<a href="mailto:holger@merlinux.eu">holger@merlinux.eu</a>><br>
> > wrote:<br>
> > ><br>
> > > > hi Thomas,<br>
> > > ><br>
> > > > On Thu, Apr 18, 2013 at 11:24 +0200, Thomas CARPENTIER wrote:<br>
> > > > > Hi,<br>
> > > > ><br>
> > > > > I'm working with pytest since few weeks now for automate my<br>
> > functionnal<br>
> > > > > tests using Webdriver and python. And i have some questions about<br>
> > how to<br>
> > > > > paramatrize tests.<br>
> > > > ><br>
> > > > > After reading docs, i've setup my tests like :<br>
> > > > ><br>
> > > > > @pytest.mark.parametrize(("Url", "name", "LastName", "IdCustomer"), [<br>
> > > > > ("<a href="http://myurl.com" target="_blank">http://myurl.com</a>", "myname", "mylastname", "12345"),<br>
> > > > > ])<br>
> > > > > def test_get_infos_about_client(Url, name, Lastname, IdCustomer):<br>
> > > > > #Do something with arguments<br>
> > > > > [...]<br>
> > > > ><br>
> > > > ><br>
> > > > > My problem is I've 2 testing environnements ENV1 and ENV2, however<br>
> > datas<br>
> > > > (<br>
> > > > > in particular IdCustomer are not the same between ENV1 and ENV2 (<br>
> > these<br>
> > > > > datas are generated during the creation of the Customer)<br>
> > > > ><br>
> > > > > So , I'm thinking about use csv files to inject datas in place of<br>
> > > > > parametrize function. But I did'nt find any docs about it. Is it<br>
> > > > possible?<br>
> > > > ><br>
> > > > > I've tried<br>
> > > > ><br>
> > > > > def pytest_generate_tests(metafunc):<br>
> > > > > #read csv file<br>
> > > > > metafunc.parametrize(header, datas)<br>
> > > > ><br>
> > > > > But it doesn't work!<br>
> > > > ><br>
> > > > > Can I do the same thing with another method ?<br>
> > > ><br>
> > > ><br>
> > > > usually pytest_generate_tests is the right place to perform<br>
> > > > config-dependent parametrization. Could you post what you<br>
> > > > tried there concretely including failure tracebacks?<br>
> > > ><br>
> > > > holger<br>
> > > ><br>
> > > ><br>
> > > > > Thnaks for your help<br>
> > > > ><br>
> > > > ><br>
> > > > > Thomas<br>
> > > ><br>
> > > > > _______________________________________________<br>
> > > > > Pytest-dev mailing list<br>
> > > > > <a href="mailto:Pytest-dev@python.org">Pytest-dev@python.org</a><br>
> > > > > <a href="http://mail.python.org/mailman/listinfo/pytest-dev" target="_blank">http://mail.python.org/mailman/listinfo/pytest-dev</a><br>
> > > ><br>
> > > ><br>
> ><br>
</div></div></blockquote></div><br></div>