I try run some parameterized tests in parallel with xdist and pytest modules. How can i do that?
When I launch parameterized tests I get message "Empty test suite." If I launch tests without parameterization everything goes well.
Additional argument:
pytest -n 2
Example one of many parameterized tests:
import pytest
from Tests_data.product import testdata
import allure
import re
@allure.severity('Blocker')
@allure.feature('Add new product')
@pytest.mark.parametrize('product', testdata, ids=[repr(i) for i in testdata])
def test_add_new_product(appf_admin, product):
with allure.step(f"Add product {product} in admin panel"):
appf_admin.admin_panel.add_new_product(product)
with allure.step(f"Get count of products {product} from search in admin panel"):
name = re.match(r'name=(\S+)', str(product))
clean_name = name.group(1)
appf_admin.admin_panel.find_product_in_catalog_by_name(clean_name)
products = appf_admin.admin_panel.get_count_product_row_from_catalog()
with allure.step(f"Checking that searching product {product} return minimum 1 row with result"):
assert products > 0
Output:
============================= test session starts =============================
platform win32 -- Python 3.7.1, pytest-4.4.1, py-1.7.0, pluggy-0.9.0
rootdir: C:\python\Test_automation\Tests
plugins: xdist-1.28.0, parallel-0.0.9, forked-1.0.2, allure-pytest-2.6.0
gw0 I / gw1 I
gw0 [0] / gw1 [0]
======================== no tests ran in 1.29 seconds =========================
Process finished with exit code 0
Empty test suite.
I expect tests will launch successfully. But I get message "Empty test suite."
Aucun commentaire:
Enregistrer un commentaire