Skip to main content
https://img.shields.io/pypi/v/pytest_localftpserver.svg https://camo.githubusercontent.com/89b9f56d30241e30f546daf9f43653f08e920f16/68747470733a2f2f696d672e736869656c64732e696f2f636f6e64612f766e2f636f6e64612d666f7267652f7079746573742d6c6f63616c6674707365727665722e737667 https://img.shields.io/pypi/pyversions/pytest_localftpserver.svg https://github.com/oz123/pytest-localftpserver/workflows/Tests/badge.svg Documentation Status Coverage

A PyTest plugin which provides an FTP fixture for your tests

Attention!

As of version 1.0.0 the support for python 2.7 and 3.4 was dropped. If you need to support those versions you should pin the version to 0.6.0, i.e. add the following lines to your “requirements_dev.txt”:

# pytest_localftpserver==0.6.0
https://github.com/oz123/pytest-localftpserver/archive/v0.6.0.zip

Usage Quickstart:

This Plugin provides the fixtures ftpserver and ftpserver_TLS, which are threaded instances of a FTP server, with which you can upload files and test FTP functionality. It can be configured using the following environment variables:

Environment variable

Usage

FTP_USER

Username of the registered user.

FTP_PASS

Password of the registered user.

FTP_PORT

Port for the normal ftp server to run on.

FTP_HOME

Home folder (host system) of the registered user.

FTP_FIXTURE_SCOPE

Scope/lifetime of the fixture.

FTP_PORT_TLS

Port for the TLS ftp server to run on.

FTP_HOME_TLS

Home folder (host system) of the registered user, used by the TLS ftp server.

FTP_CERTFILE

Certificate (host system) to be used by the TLS ftp server.

See the tests directory or the documentation for examples.

You can either set environment variables on a system level or use tools such as pytest-env or tox, to change the default settings of this plugin. Sample config for pytest-cov:

$ cat pytest.ini
[pytest]
env =
    FTP_USER=benz
    FTP_PASS=erni1
    FTP_HOME = /home/ftp_test
    FTP_PORT=31175
    FTP_FIXTURE_SCOPE=function
    # only affects ftpserver_TLS
    FTP_PORT_TLS = 31176
    FTP_HOME_TLS = /home/ftp_test_TLS
    FTP_CERTFILE = ./tests/test_keycert.pem

Sample config for Tox:

$ cat tox.ini
[tox]
envlist = py{36,37,38,39,310}

[testenv]
setenv =
    FTP_USER=benz
    FTP_PASS=erni1
    FTP_HOME = {envtmpdir}
    FTP_PORT=31175
    FTP_FIXTURE_SCOPE=function
    # only affects ftpserver_TLS
    FTP_PORT_TLS = 31176
    FTP_HOME_TLS = /home/ftp_test_TLS
    FTP_CERTFILE = {toxinidir}/tests/test_keycert.pem
commands =
    pytest tests

Credits

This package was inspired by, https://pypi.org/project/pytest-localserver/ made by Sebastian Rahlf, which lacks an FTP server.

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

Metadata

Release files for pytest-localftpserver 1.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytest-localftpserver 1.2.0
File Size Uploaded
pytest_localftpserver-1.2.0.tar.gz 48.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pytest-localftpserver 1.2.0
File Interpreter ABI Platform
pytest_localftpserver-1.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 70.7 kB

Release files / pytest_localftpserver-1.2.0.tar.gz

Download URL pytest_localftpserver-1.2.0.tar.gz
Size 48.8 kB
Tags Source
SHA-256 checksum
How to use checksums
099512c3d8a1ca24808df31d85b426d8653ca6f178d6d8f3c1898d302c053b3e
BLAKE2b-256 checksum
How to use checksums
c166341dc3e965b62abf78d32f30eb462441cd189348af6a911acc0e501c7175
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.18

Release files / pytest_localftpserver-1.2.0-py3-none-any.whl

Download URL pytest_localftpserver-1.2.0-py3-none-any.whl
Size 21.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7f92af7ef172bb282e5c2f3c62ae78f1c49f93edd8b52be3b5f54aa5e487acb3
BLAKE2b-256 checksum
How to use checksums
5108ce99fae916232db777bd20d685d35c7649a3f316c86a96d6490b3e768a69
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.18

Release history Release notifications | RSS feed

1.6.0

2 release files

1.5.0

2 release files

1.4.0

2 release files

1.3.2

2 release files

1.3.1

2 release files

This release

1.2.0 This release

2 release files

1.1.4

2 release files

1.1.3

2 release files

1.1.2

2 release files

1.0.1

2 release files

1.0.0

1 release file

0.5.1

1 release file

0.4.1

1 release file

0.4.0

1 release file

0.3.1

1 release file

0.3.0

1 release file

0.2.0

1 release file

0.1.1

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page