[pytest-dev] Questions about paramtrize and csv files
holger krekel
holger at merlinux.eu
Thu Apr 18 11:35:18 CEST 2013
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
More information about the Pytest-dev
mailing list