File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- """
1+ """ Configuration required for tests to run
2+
3+ Note that fastapi makes available a test client that can be used to
4+ test the API endpoints. This will call the endpoints internally.
25
6+ For the taskiq to work we have configured it to use the InMemoryBroker
7+ otherwise it will try to connect to a redis server.
8+
9+ Please note you will require pytest-env for the environment variables
10+ to work which are set via pyproject.toml
311"""
412import pytest
513
14+
615@pytest .fixture (scope = 'session' )
716def test_client ():
817 from fastapi .testclient import TestClient
918 from labs .api import app
1019 return TestClient (app )
20+
21+
22+ @pytest .fixture
23+ def anyio_backend ():
24+ """ Since taskiq is fully async, we suggest using anyio
25+
26+ See configuration described in the docs:
27+ https://taskiq-python.github.io/guide/testing-taskiq.html#async-tests
28+ """
29+ return 'asyncio'
You can’t perform that action at this time.
0 commit comments