3👍
✅
You can use glob from python which is used to return all file paths that match a specific pattern
import glob
@pytest.fixture(scope="session")
def load_admin_data(django_db_setup, django_db_blocker):
with django_db_blocker.unblock():
call_command('loaddata',glob.glob('fixtures_for_tests/basic_fixtures/*'))
Also if you want to add more folders, you can do it by
import glob
@pytest.fixture(scope="session")
def django_db_setup1(django_db_setup, django_db_blocker):
with django_db_blocker.unblock():
call_command('loaddata',
glob.glob('fixtures_for_tests/basic_fixtures/*'), glob.glob('fixtures_for_tests/admins/*'))
Source:stackexchange.com