def call_test_db_command(command):
    for alias in connections:
        connection = connections[alias]
        old_name = connection.settings_dict["NAME"]
        test_db_name = get_test_db_name(connection)
        if not old_name.startswith('test_'):
            reset_connection(connection, test_db_name)
            call_command(command,
                interactive=False,
                database=connection.alias,
                load_initial_data=False)
            reset_connection(connection, old_name)
Call command on test database
dataset/ETHPy150Open plus500s/django-test-tools/test_tools/signals.py/call_test_db_command