{"library":"pytest-sftpserver","title":"pytest-sftpserver","description":"pytest-sftpserver is a plugin for pytest that provides a local SFTP-Server fixture. The SFTP-Server provided by this fixture serves content directly from Python objects instead of files, simplifying local testing of SFTP client connections. The current version is 1.3.0, released in 2019, suggesting a moderate release cadence based on maintenance needs.","language":"python","status":"maintenance","last_verified":"Fri May 15","install":{"commands":["pip install pytest-sftpserver"],"cli":null},"imports":["def test_my_sftp_client(sftpserver): ..."],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"from contextlib import closing\nimport paramiko\nimport pytest\nimport os\n\n# Helper function that would typically be part of your application code\ndef get_sftp_file(host, port, username, password, path):\n    with closing(paramiko.Transport((host, port))) as transport:\n        transport.connect(username=username, password=password)\n        with closing(paramiko.SFTPClient.from_transport(transport)) as sftpclient:\n            with sftpclient.open(path, \"r\") as sftp_file:\n                return sftp_file.read().decode('utf-8')\n\n# A test function using the sftpserver fixture\ndef test_sftp_fetch(sftpserver):\n    # The sftpserver fixture is automatically discovered and injected\n    # It serves content from Python objects (dictionaries)\n    with sftpserver.serve_content({'a_dir': {'somefile.txt': b\"File content\"}}):\n        # Use environment variables or dummy values for actual connection\n        # In a real scenario, these might come from test configuration\n        assert get_sftp_file(sftpserver.host, sftpserver.port, \"user\", \"pw\", \"/a_dir/somefile.txt\") == \"File content\"\n","lang":"python","description":"To use `pytest-sftpserver`, define a test function that accepts the `sftpserver` fixture. Inside the test, use `sftpserver.serve_content()` as a context manager to specify the in-memory file structure to be served. Client code (e.g., using `paramiko`) can then connect to the SFTP server using `sftpserver.host` and `sftpserver.port` to interact with this content. Note that `paramiko` is a common dependency for client code interacting with the SFTP server, but not a direct dependency of the `pytest-sftpserver` plugin itself.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":{"tag":null,"tag_description":null,"last_tested":"2026-05-15","installed_version":"1.3.0","pypi_latest":"1.3.0","is_stale":false,"summary":{"python_range":"3.10–3.9","success_rate":100,"avg_install_s":2.9,"avg_import_s":null,"wheel_type":"wheel"},"results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"pytest-sftpserver","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"42.1M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"pytest-sftpserver","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":3.1,"import_time_s":null,"mem_mb":null,"disk_size":"42M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"pytest-sftpserver","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"44.8M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"pytest-sftpserver","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":2.9,"import_time_s":null,"mem_mb":null,"disk_size":"45M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"pytest-sftpserver","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"36.5M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"pytest-sftpserver","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":2.5,"import_time_s":null,"mem_mb":null,"disk_size":"37M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"pytest-sftpserver","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"36.2M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"pytest-sftpserver","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":2.6,"import_time_s":null,"mem_mb":null,"disk_size":"37M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"pytest-sftpserver","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"42.3M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"pytest-sftpserver","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":3.5,"import_time_s":null,"mem_mb":null,"disk_size":"43M"}]}}