Skip to main content

No project description provided

Project description

You need a temporary ftp server in your python unittests?

This small library provides you the class called FTPServerContext.

Uses pyftpdlib to run the ftp-server.


  • ftp
  • ftps (FTP over TLS)

Does not support:

  • sftp (FTP via SSH)



temp_dir = tempfile.mkdtemp()
with FTPServerContext(temp_dir) as ftp_context:
    # now you have these variables for testing your ftp client code:


Via pip:

pip install ftpservercontext



With subprocess.Popen() a script called serve_directory_via_ftp gets called.

You provide FTPServerContext a directory and the ftp server serves this directory via ftp running on ‘’ and a matching open port.

If the python interpreter leaves the with-block, then the subprocess running the ftp-server gets automatically terminated.

You can see a working example in the unittest:


Feedback is welcome. Just open an issue at github, even if you just want to say “thank you”.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for ftpservercontext, version 2018.3.0
Filename, size File type Python version Upload date Hashes
Filename, size ftpservercontext-2018.3.0.tar.gz (3.4 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page