{"id":24432,"library":"pytest-localftpserver","title":"pytest-localftpserver","description":"A PyTest plugin that provides an FTP fixture (localftpserver) for your tests, enabling you to spin up a real FTP server during testing. Version 1.5.0 is the latest release; the project is in maintenance mode with infrequent updates.","status":"maintenance","version":"1.5.0","language":"python","source_language":"en","source_url":"https://github.com/cesarcoatl/pytest-localftpserver","tags":["pytest","ftp","testing","plugin"],"install":[{"cmd":"pip install pytest-localftpserver","lang":"bash","label":"Install via pip"}],"dependencies":[],"imports":[{"note":"The fixture is automatically registered by the plugin; just add 'localftpserver' as a parameter to your test function.","symbol":"localftpserver","correct":"no import needed; use fixture name in test function argument"}],"quickstart":{"code":"def test_ftp(localftpserver):\n    with localftpserver.session() as ftp:\n        ftp.login('user', 'pass')\n        ftp.cwd('/')\n        assert ftp.pwd() == '/'\n        ftp.storbinary('STOR testfile', b'data')\n        ftp.retrbinary('RETR testfile', lambda x: None)","lang":"python","description":"A minimal test using the localftpserver fixture. The fixture starts an FTP server on a random port; the session() context manager gives you a connected FTP client."},"warnings":[{"fix":"Use the default configuration or set the port via pytest options.","message":"The fixture starts a real FTP server on a random port; ensure you don't have conflicting services or firewall restrictions.","severity":"gotcha","affected_versions":"all"},{"fix":"Consider using alternative solutions like pyftpdlib directly or pytest-docker for FTP testing.","message":"The project has not been updated in years and may have compatibility issues with newer Python versions or pytest 7+.","severity":"deprecated","affected_versions":">=1.5.0"},{"fix":"Always use the session() context manager or manually close the FTP client.","message":"The fixture does not clean up the server after each test by default; ensure you close sessions properly to avoid hanging processes.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Ensure pytest-localftpserver is installed and you didn't try to import the fixture manually. Just use it as a test parameter.","cause":"The fixture is not imported; it's automatically provided by the plugin when installed.","error":"NameError: name 'localftpserver' is not defined"},{"fix":"Do not assign the fixture name to a string; let pytest inject the fixture object via the function argument.","cause":"Using 'localftpserver' as a string variable instead of the fixture name.","error":"AttributeError: 'str' object has no attribute 'session'"},{"fix":"Ensure each test cleans up after itself. You can also specify a different port via --localftpserver-port option.","cause":"The FTP server port is already in use (e.g., from a previous test that didn't shut down).","error":"OSError: [Errno 98] Address already in use"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}