Now I have code like this:
from rest_framework.test import APITestCase
class MyTestClass(ApiTestCase):
fixtures = ['some_fixtures.json', ]
@pytest.mark.parametrize('field, reverse_ordering', [
('id', False),
('id', True)])
def test_ordering(self, field, reverse_ordering):
# some test function
Every time it is failed with that error:
======================================================================
ERROR: test_ordering (my_module.tests.MyTestClass)
----------------------------------------------------------------------
TypeError: test_ordering() missing 2 required positional arguments: 'field' and 'reverse_ordering'
How it is possible to use @pytest.mark.parametrize
decorator with tests inside of APITestCase
from DRF tests class?
Maybe there is some another way to parametrize tests (but not loops)?
subTest
now, but i do not like the way it looks. All my test classes are inherited from my own specificBaseTestClass(ApiTestCase)
. (I mean I can not rewrite it for separated test functions) – Third