{"id":21812,"library":"pytest-servers","title":"pytest-servers","description":"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.","status":"active","version":"0.5.13","language":"python","source_language":"en","source_url":"https://github.com/iterative/pytest-servers","tags":["pytest","testing","docker","s3","gcs","azure","sftp","mock"],"install":[{"cmd":"pip install pytest-servers","lang":"bash","label":"Default install (includes all extras)"},{"cmd":"pip install 'pytest-servers[s3]'","lang":"bash","label":"S3 only"},{"cmd":"pip install 'pytest-servers[gcs]'","lang":"bash","label":"GCS only"},{"cmd":"pip install 'pytest-servers[azure]'","lang":"bash","label":"Azure only"},{"cmd":"pip install 'pytest-servers[sftp]'","lang":"bash","label":"SFTP only"}],"dependencies":[{"reason":"Required to run containerized servers.","package":"docker","optional":false},{"reason":"Required for S3 server fixture.","package":"boto3","optional":true},{"reason":"Required for GCS server fixture.","package":"google-cloud-storage","optional":true},{"reason":"Required for Azure Blob server fixture.","package":"azure-storage-blob","optional":true},{"reason":"Required for SFTP server fixture.","package":"paramiko","optional":true},{"reason":"Plugin requires pytest to run.","package":"pytest","optional":false}],"imports":[{"note":"s3_server is in a submodule, not top-level.","wrong":"from pytest_servers import s3_server","symbol":"s3_server","correct":"from pytest_servers.s3 import s3_server"},{"note":"No common wrong import found.","symbol":"gcs_server","correct":"from pytest_servers.gcs import gcs_server"},{"symbol":"azurite_server","correct":"from pytest_servers.azure import azurite_server"},{"symbol":"sftp_server","correct":"from pytest_servers.sftp import sftp_server"}],"quickstart":{"code":"import pytest\nfrom pytest_servers.s3 import s3_server\nfrom pytest_servers.gcs import gcs_server\nfrom pytest_servers.azure import azurite_server\nfrom pytest_servers.sftp import sftp_server\n\n@pytest.mark.usefixtures('s3_server')\ndef test_s3():\n    # s3_server fixture starts a mock S3 server (using minio) in a Docker container\n    # The endpoint is available via os.environ['AWS_ENDPOINT_URL']\n    import os\n    assert 'AWS_ENDPOINT_URL' in os.environ\n    print(f\"S3 endpoint: {os.environ['AWS_ENDPOINT_URL']}\")\n\n@pytest.mark.usefixtures('gcs_server')\ndef test_gcs():\n    import os\n    assert 'STORAGE_EMULATOR_HOST' in os.environ\n    print(f\"GCS endpoint: {os.environ['STORAGE_EMULATOR_HOST']}\")\n\n@pytest.mark.usefixtures('azurite_server')\ndef test_azure():\n    import os\n    assert 'AZURITE_HOST' in os.environ\n    print(f\"Azure endpoint: {os.environ['AZURITE_HOST']}\")\n\n@pytest.mark.usefixtures('sftp_server')\ndef test_sftp():\n    import os\n    assert 'SFTP_HOST' in os.environ\n    print(f\"SFTP endpoint: {os.environ['SFTP_HOST']}\")","lang":"python","description":"Use fixtures to start local mock servers for testing cloud storage integrations."},"warnings":[{"fix":"Upgrade to >=0.5.4 to use 'gs' as a server type, or continue using 'gcs'.","message":"The 'gs' alias for 'gcs' was added in 0.5.4. Previously, only 'gcs' was accepted.","severity":"breaking","affected_versions":"<0.5.4"},{"fix":"Use explicit imports from submodules to avoid future breakage.","message":"The fixture names are subject to change; check the latest docs for exact names.","severity":"deprecated","affected_versions":"all"},{"fix":"Ensure Docker is installed and the daemon is running before using fixtures.","message":"Docker is required; the plugin will fail if Docker is not running or not installed.","severity":"gotcha","affected_versions":"all"},{"fix":"Check port availability or adjust via environment variables (if supported).","message":"Port conflicts: if the default port (e.g., 9000 for minio) is already in use, the fixture will fail.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Install with `pip install pytest-servers` and use correct import: `from pytest_servers.s3 import s3_server`.","cause":"pytest-servers is not installed or the import path is wrong.","error":"ModuleNotFoundError: No module named 'pytest_servers'"},{"fix":"Start Docker and ensure your user has access (e.g., add to docker group).","cause":"Docker daemon is not running or the user does not have permissions.","error":"docker.errors.DockerException: Error while fetching server API version: ..."},{"fix":"Install pytest-servers and either use `pytest_plugins = ['pytest_servers.s3']` in conftest or import the fixture directly.","cause":"The fixture is not registered; likely missing the plugin or import.","error":"pytest fixture 's3_server' not found"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}