Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: allow to select async backend and implementation
We add a --anyio={asyncio,trio} option to pytest to select the AnyIO backend to run async tests. When this option is set, we'll use the AnyIO implementations of psycopg API (i.e. AnyIOConnection, resp. waiting functions, etc.); otherwise (the default), we'll use plain asyncio implementations (i.e. AsyncConnection). This way, we can now run the test suite with: - plain asyncio implementations (previously achieved through the asyncio backend for AnyIO pytest plugin), - AnyIO implementations, with asyncio backend (new from this commit), - AnyIO implementations, with trio backend (previously achieved through the Trio backend for AnyIO pytest plugin). Accordingly, the anyio_backend fixture is no longer parametrized and its value depends on the --anyio option. Selection of whether to use AnyIO or plain asyncio implementations is done through the new 'use_anyio' fixture, which simply detects if no --anyio option got specified. This new fixture is used everywhere we used anyio_backend_name fixture previously to select either plain asyncio or anyio variants of test cases. The fixture pulls (but does not use) anyio_backend so that all tests using it will be detected as async. In CI, we add a new pytest_opts axis to the matrix to cover all configurations in various environments.
- Loading branch information
Showing
6 changed files
with
85 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters