skillfed

pytest-sftpserver

py.test plugin to locally test sftp server connections.

pytest-sftpserver v1.3.0 1.1M downloads/30d#4,411 on PyPI39
Permissive license MIT License DORMANT released

What it is and what it does

pytest-sftpserver is a pytest plugin that injects an SFTP server fixture into your tests. Rather than serving files from disk, it serves content directly from Python objects—dictionaries representing directory structures and file contents. This lets you test SFTP client code (code that connects to and downloads from SFTP servers) without spinning up a real external server or managing temporary files.

The plugin depends on paramiko for SFTP protocol handling and six for Python 2/3 compatibility. It's designed for unit and integration testing of SFTP client functions. The package has been dormant since 2019 but remains functional; it targets Python 2.7 and 3.5–3.7 according to its classifiers.

Use it for:

  • Unit test an SFTP client function by mocking server responses with in-memory file structures instead of real files.
  • Integration test a data pipeline that fetches files from SFTP without requiring a live SFTP server in CI/CD.
  • Test error handling in SFTP client code by simulating missing files or permission issues via the mock server.
  • Verify SFTP connection logic and authentication flows in isolation without external infrastructure.
  • Test directory traversal and recursive file operations against a controlled mock SFTP environment.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

A pytest plugin that provides a fixture for testing SFTP client code against an in-memory mock SFTP server without needing an external server.

Yes, if you need to test SFTP client code and want to avoid external server setup. The low install friction, permissive license, and zero known vulnerabilities make it a straightforward choice. However, note that the package is dormant (last release 2019) and classifiers indicate support only through Python 3.7—verify compatibility with your target Python version before adopting.

Install

pytest-sftpserver on PyPI

pip

pip install pytest-sftpserver

uv

uv add pytest-sftpserver

poetry

poetry add pytest-sftpserver

Installing pytest-sftpserver

Before you install

Low install friction with only two runtime dependencies (paramiko and six). The package is dormant—last release was 2019-09-16 and last commit 2024-03-20—so maintenance is minimal but the codebase remains archived and functional.

License in practice

MIT License (permissive) means you can use, modify, and distribute this package freely in both open-source and commercial projects with minimal restrictions.

Quickstart

pip install pytest-sftpserver

import pytest
from pytest_sftpserver import sftpserver

def test_sftp_fetch(sftpserver):
    with sftpserver.serve_content({'a_dir': {'somefile.txt': 'File content'}}):
        # Test your SFTP client code here
        pass

Verify before relying

  • Whether the package works with Python versions beyond 3.7 (classifiers list only 2.7, 3.5–3.7, but last commit is 2024)
  • Whether paramiko and six versions have known compatibility issues with modern Python environments

Package facts

License MIT License (permissive)
Python support not specified
Install friction low — pure-Python wheel
Runtime dependencies 2 — paramiko, six
Maintenance dormant — 2,524 days since the last release
Last repo commit
First released
Downloads 1,067,149/month — #4,411 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: pytest_sftpserver-1.3.0-py2.py3-none-any.whl

Keywords: py.test, pytest, plugin, server, local, sftp, localhost

Development Status :: 4 - BetaIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 2.7Programming Language :: Python :: 3.5Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Topic :: Software Development :: Testing

Tags

pytest sftp server fixturemock sftp testinglocal sftp server testingsftp client unit testspytest sftp mockin-memory sftp servertest sftp connections locally
pytest-pluginsftp-testingmock-server

More Testing packages