Open
Description
I have a simple test with parametrization:
@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
And simple generator of test data for parametrezation:
def random_string(maxlen):
symbol = string.ascii_letters + string.digits
return ''.join([random.choice(symbol) for i in range(random.randrange(1,maxlen))])
def random_digits(maxlen):
symbol = string.digits
return ''.join([random.choice(symbol) for i in range(random.randrange(1,maxlen))])
testdata_raw = [
Product(name=random_string(10), short_description=random_string(10), description=random_string(100),
USD=random_digits(3)) for i in range(4)]
testdata = sorted(testdata_raw, key=lambda obj: obj.name)
When i launch test with additional argument:
-n 2
I get this error message:
============================= test session starts =============================
platform win32 -- Python 3.7.1, pytest-4.4.1, py-1.7.0, pluggy-0.9.0
rootdir: C: ...\Tests
plugins: xdist-1.28.0, parallel-0.0.9, forked-1.0.2, allure-pytest-2.6.0
gw0 I / gw1 I
gw0 [4] / gw1 [4]
gw1:None (gw1)
Different tests were collected between gw0 and gw1. The difference is:
--- gw0
+++ gw1
@@ -1,4 +1,4 @@
-test_add_new_product_with_param.py::test_add_new_product[name=LgysR6Y | USD=31 | id=None]
-test_add_new_product_with_param.py::test_add_new_product[name=hIx | USD=7 | id=None]
-test_add_new_product_with_param.py::test_add_new_product[name=lbpoI | USD=56 | id=None]
-test_add_new_product_with_param.py::test_add_new_product[name=pE | USD=51 | id=None]
+test_add_new_product_with_param.py::test_add_new_product[name=0fUz | USD=39 | id=None]
+test_add_new_product_with_param.py::test_add_new_product[name=b0heCg | USD=16 | id=None]
+test_add_new_product_with_param.py::test_add_new_product[name=sD | USD=8 | id=None]
+test_add_new_product_with_param.py::test_add_new_product[name=uHSt | USD=58 | id=None]
=================================== ERRORS ====================================
____________________________ ERROR collecting gw1 _____________________________
Different tests were collected between gw0 and gw1. The difference is:
--- gw0
+++ gw1
@@ -1,4 +1,4 @@
-test_add_new_product_with_param.py::test_add_new_product[name=LgysR6Y | USD=31 | id=None]
-test_add_new_product_with_param.py::test_add_new_product[name=hIx | USD=7 | id=None]
-test_add_new_product_with_param.py::test_add_new_product[name=lbpoI | USD=56 | id=None]
-test_add_new_product_with_param.py::test_add_new_product[name=pE | USD=51 | id=None]
+test_add_new_product_with_param.py::test_add_new_product[name=0fUz | USD=39 | id=None]
+test_add_new_product_with_param.py::test_add_new_product[name=b0heCg | USD=16 | id=None]
+test_add_new_product_with_param.py::test_add_new_product[name=sD | USD=8 | id=None]
+test_add_new_product_with_param.py::test_add_new_product[name=uHSt | USD=58 | id=None]
=========================== 1 error in 1.09 seconds ===========================
Process finished with exit code 0
Tell me please what could be the problem
Metadata
Metadata
Assignees
Labels
No labels