
Security News
Potemkin Understanding in LLMs: New Study Reveals Flaws in AI Benchmarks
New research reveals that LLMs often fake understanding, passing benchmarks but failing to apply concepts or stay internally consistent.
.. image:: https://img.shields.io/pypi/v/pytest-sftpserver.svg?style=flat :target: https://pypi.python.org/pypi/pytest-sftpserver/ :alt: Latest Version .. image:: https://img.shields.io/circleci/build/gh/ulope/pytest-sftpserver/master :alt: Circle CI build status :target: https://circleci.com/gh/ulope/workflows/pytest-sftpserver .. image:: https://img.shields.io/codeclimate/coverage/ulope/pytest-sftpserver :alt: Code Climate coverage :target: https://codeclimate.com/github/ulope/pytest-sftpserver .. image:: https://img.shields.io/pypi/pyversions/pytest-sftpserver.svg?style=flat :target: https://pypi.python.org/pypi/pytest-sftpserver/ :alt: Supported versions .. image:: https://img.shields.io/pypi/l/pytest-sftpserver?style=flat&color=20d020 :target: https://pypi.python.org/pypi/pytest-sftpserver/ :alt: License .. image:: https://requires.io/github/ulope/pytest-sftpserver/requirements.svg?branch=master :target: https://requires.io/github/ulope/pytest-sftpserver/requirements/?branch=master :alt: Requirements Status
pytest-sftpserver is a plugin for pytest
_ that provides a local SFTP-Server
fixture
_.
The SFTP-Server provided by this fixture serves content not from files but directly from Python objects.
Assume you want to test a function that downloads a file from an SFTP-Server:
.. code-block:: python
from contextlib import closing
import paramiko
def get_sftp_file(host, port, username, password, path):
with closing(paramiko.Transport((host, port))) as transport:
transport.connect(username=username, password=password)
with closing(paramiko.SFTPClient.from_transport(transport)) as sftpclient:
with sftpclient.open(path, "r") as sftp_file:
return sftp_file.read()
This plugin allows to test such functions without having to spin up an external
SFTP-Server by providing a pytest fixture
_ called sftpserver
. You use it
simply by adding a parameter named sftpserver
to your test function:
.. code-block:: python
def test_sftp_fetch(sftpserver):
with sftpserver.serve_content({'a_dir': {'somefile.txt': "File content"}}):
assert get_sftp_file(sftpserver.host, sftpserver.port, "user",
"pw", "/a_dir/somefile.txt") == "File content"
As can be seen from this example sftpserver
serves content directly from
python objects instead of files.
pip install pytest-sftpserver
This package supports the following Python versions:
Updated supported Python versions to 2.7, 3.5 - 3.7.
Droped (official) support for 3.4.
Check / format code with black
, isort
and flake8
.
Fix return type of .read()
. (#15, thanks @WeatherGod)
Support the offset
parameter on write operations. (#11, #16, thanks @DrNecromant)
Thanks to @zerok for both bug reports and accompanying tests.
chmod()
behaviour for non-existing 'files' (Thanks @dundeemt)stat()
behaviour for non-existing 'files'Licensed unter the MIT License. See file LICENSE
.
The implementation and idea for this plugin is in part based upon:
pytest-localserver
_sftpserver
_Twisted Conch in 60 Seconds
_ series (although I ended up not using
twisted, this was very helpful understanding SFTP internals).. _pytest: http://pytest.org/latest/ .. _fixture: http://pytest.org/latest/fixture.html#fixtures-as-function-arguments .. _pytest-localserver: https://bitbucket.org/basti/pytest-localserver .. _sftpserver: https://github.com/rspivak/sftpserver .. _Twisted Conch in 60 Seconds: http://as.ynchrono.us/2011/04/twisted-conch-in-60-seconds-trivial.html
FAQs
py.test plugin to locally test sftp server connections.
We found that pytest-sftpserver demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
New research reveals that LLMs often fake understanding, passing benchmarks but failing to apply concepts or stay internally consistent.
Security News
Django has updated its security policies to reject AI-generated vulnerability reports that include fabricated or unverifiable content.
Security News
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.