MR
Size: a a a
MR
MR
val1 неправильно передается и вызываетсяSC
MR
SC
@pytest.mark.parametrize('val1',[1,2,3])
class test1:
def test_one(self, val1)
pass
def test_two(self, val1)
passподскажите пожалуйста как pytest
через fixture
задать parametrize для class и функций
СС
СС
@pytest.fixture(scope='class', params=[1, 2, 3])
def class_fixture(request):
return request.param * random.randint(1, 1000)
@pytest.fixture(scope='function', params=[1, 2, 3])
def func_fixture(request):
return request.param * random.randint(1, 1000)
class Test:
def test(self, class_fixture, func_fixture):
print(class_fixture, func_fixture)
def test1(self, class_fixture, func_fixture):
print(class_fixture, func_fixture)
SC
AK
M
OC
class TestMyClass(unittests.TestCase):
....
class TestMyClass(unittests.TestCase):
@pytest.fixture()
def my_fixture(self):
return 'test'
def test_via_my_fixture(self, my_fixture):
self.assertEqual(my_fixture, "test")
СС
СС
IS
IB
АЧ
P
M
O
V