I warm asking you to help me here:
import pytest
@pytest.mark.parametrize("url1", ["url0001", "url0002", "url0003"], indirect=False)
class Test01:
def test01(self, url1):
print(url1)
assert url1 == f"{url1}"
def test02(self, url1):
print(url1)
assert url1 == f"{url1}"
result:
venv/test_url_fixt.py::Test01::test01[url0001] PASSED [ 16%]url0001
venv/test_url_fixt.py::Test01::test01[url0002] PASSED [ 33%]url0002
venv/test_url_fixt.py::Test01::test01[url0003] PASSED [ 50%]url0003
venv/test_url_fixt.py::Test01::test02[url0001] PASSED [ 66%]url0001
venv/test_url_fixt.py::Test01::test02[url0002] PASSED [ 83%]url0002
venv/test_url_fixt.py::Test01::test02[url0003] PASSED [100%]url0003
============================== 6 passed in 0.03s ==============================
Process finished with exit code 0
target result:
venv/test_url_fixt.py::Test01::test01[url0001] PASSED [ 16%]url0001
venv/test_url_fixt.py::Test01::test02[url0001] PASSED [ 33%]url0001
venv/test_url_fixt.py::Test01::test01[url0002] PASSED [ 50%]url0002
venv/test_url_fixt.py::Test01::test02[url0002] PASSED [ 66%]url0002
venv/test_url_fixt.py::Test01::test01[url0003] PASSED [ 83%]url0003
venv/test_url_fixt.py::Test01::test02[url0003] PASSED [100%]url0003
============================== 6 passed in 0.03s ==============================
Process finished with exit code 0
Info: I just need to execute test01 with url1 = url0001, test02 with url1 = url0001 and automatically iter next loop > test01 with url1 = url0002, test02 with url1 = url0002 > and so on. I have the list of urls and want to execute properly set of tests with that list of urls. You will be the champion for me!
Aucun commentaire:
Enregistrer un commentaire