Registry / testing / pytest-servers

pytest-servers

JSON →
library0.5.13pypypi✓ verified 86d ago

Pytest plugin providing fixtures for local mock servers (S3, GCS, Azure Blob, SFTP) using Docker containers. Version 0.5.13, actively maintained with frequent minor releases.

pip install pytest-servers
INSTALL
IMPORT
SIG · PYTEST-SERVERS
P
pytest-servers
testingpythonv0.5.13
Install
10.3s avg
Import
392ms
Disk
76MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.5.13 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.925 runs
installs and imports cleanly · install 0.0s · import 0.410s · 72.8MB
glibc
py 3.103.925 runs
installs and imports cleanly · install 12.3s · import 0.374s · 75MB
76MB installed
● package 76MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

s3_server
from pytest_servers.s3 import s3_server
from pytest_servers import s3_server
s3_server is in a submodule, not top-level.
gcs_server
from pytest_servers.gcs import gcs_server
No common wrong import found.
azurite_server
from pytest_servers.azure import azurite_server
sftp_server
from pytest_servers.sftp import sftp_server

Use fixtures to start local mock servers for testing cloud storage integrations.

import pytest from pytest_servers.s3 import s3_server from pytest_servers.gcs import gcs_server from pytest_servers.azure import azurite_server from pytest_servers.sftp import sftp_server @pytest.mark.usefixtures('s3_server') def test_s3(): # s3_server fixture starts a mock S3 server (using minio) in a Docker container # The endpoint is available via os.environ['AWS_ENDPOINT_URL'] import os assert 'AWS_ENDPOINT_URL' in os.environ print(f"S3 endpoint: {os.environ['AWS_ENDPOINT_URL']}") @pytest.mark.usefixtures('gcs_server') def test_gcs(): import os assert 'STORAGE_EMULATOR_HOST' in os.environ print(f"GCS endpoint: {os.environ['STORAGE_EMULATOR_HOST']}") @pytest.mark.usefixtures('azurite_server') def test_azure(): import os assert 'AZURITE_HOST' in os.environ print(f"Azure endpoint: {os.environ['AZURITE_HOST']}") @pytest.mark.usefixtures('sftp_server') def test_sftp(): import os assert 'SFTP_HOST' in os.environ print(f"SFTP endpoint: {os.environ['SFTP_HOST']}")
Debug
Known issues
breakingThe 'gs' alias for 'gcs' was added in 0.5.4. Previously, only 'gcs' was accepted.
fix
Upgrade to >=0.5.4 to use 'gs' as a server type, or continue using 'gcs'.
affects: <0.5.4
deprecatedThe fixture names are subject to change; check the latest docs for exact names.
fix
Use explicit imports from submodules to avoid future breakage.
affects: all
gotchaDocker is required; the plugin will fail if Docker is not running or not installed.
fix
Ensure Docker is installed and the daemon is running before using fixtures.
affects: all
gotchaPort conflicts: if the default port (e.g., 9000 for minio) is already in use, the fixture will fail.
fix
Check port availability or adjust via environment variables (if supported).
affects: all
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'pytest_servers'
pytest-servers is not installed or the import path is wrong.
fix
Install with `pip install pytest-servers` and use correct import: `from pytest_servers.s3 import s3_server`.
docker.errors.DockerException: Error while fetching server API version: ...
Docker daemon is not running or the user does not have permissions.
fix
Start Docker and ensure your user has access (e.g., add to docker group).
pytest fixture 's3_server' not found
The fixture is not registered; likely missing the plugin or import.
fix
Install pytest-servers and either use `pytest_plugins = ['pytest_servers.s3']` in conftest or import the fixture directly.
Upgrade
Version history
0.5.13latest on PyPI · released Dec 21, 2025
Audit
Dependencies
dockerrequiredRequired to run containerized servers.
boto3optionalRequired for S3 server fixture.
google-cloud-storageoptionalRequired for GCS server fixture.
azure-storage-bloboptionalRequired for Azure Blob server fixture.
paramikooptionalRequired for SFTP server fixture.
pytestrequiredPlugin requires pytest to run.
Agent activity
56 hits · last 30 days
node
48
Bingbot
1
OpenAI (training)
1
Resources
pytest-servers — pip install pytest-servers · libregistry