[pytest-dev] Questions about paramtrize and csv files

Thomas CARPENTIER carpentier.th at gmail.com
Thu Apr 18 11:24:50 CEST 2013


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 ?

Thnaks for your help


Thomas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pytest-dev/attachments/20130418/78e16974/attachment.html>


More information about the Pytest-dev mailing list