PyTest FTP Server
A PyTest plugin which provides an FTP fixture for your tests
Free software: MIT license
Documentation: https://pytest-localftpserver.readthedocs.io/en/latest/index.html
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 pytest_localftpserver==0.6.0.
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 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 of the registered user, used by the TLS ftp server. |
FTP_CERTFILE |
Certificate 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{27,34,35,36,37}
[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 =
py.test 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.
History
1.0.0 (2019-09-05)
Dropped support for Python 2.7 and 3.4
0.6.0 - released as tag only
Added fixture scope configuration.
Added ftpserver_TLS as TLS version of the fixture.
0.5.0 (2018-12-04)
Added support for Windows.
Added hightlevel interface.
0.1.0 (2016-12-09)
First release on PyPI.
Metadata
Release files for pytest-localftpserver 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pytest_localftpserver-1.0.0.tar.gz | 35.0 kB | Details |
Release files / pytest_localftpserver-1.0.0.tar.gz
| Download URL | pytest_localftpserver-1.0.0.tar.gz |
|---|---|
| Size | 35.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
04cce7dc2b0a05c3d364e86d9e38e255b478d24376e3f651b1af83bb957c3fc3
|
|
BLAKE2b-256 checksum How to use checksums |
b81adc9ee8ab493fd2b979dd4a8f971707c3eb4009193875a02e5c5a7e119963
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.6.5
|