Skip to content

Bug: SFTP test container use deprecated invocation of function wait_for_logs #994

@jankoprowski

Description

@jankoprowski

Describe the bug

During tests using testcontainers SFTP module I'm getting deprecation warning from testcontainers core module:

/.venv/lib/python3.12/site-packages/testcontainers/sftp/__init__.py:269: DeprecationWarning: The wait_for_logs function with string or callable predicates is deprecated and will be removed in a future version. Use structured wait strategies instead: container.waiting_for(LogMessageWaitStrategy('ready')) or container.waiting_for(LogMessageWaitStrategy(re.compile(r'pattern')))
    wait_for_logs(self, f".*Server listening on 0.0.0.0 port {self.port}.*")

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html

To Reproduce

Test to reproduce the issue:

from testcontainers.sftp import SFTPContainer

def test():
    with SFTPContainer() as sftp_container:
        assert True

Runtime environment

# Get the operating system information (on a unix os).
$ uname -a
Linux LT-1H845226VB 5.15.167.4-microsoft-standard-WSL2 #1 SMP Tue Nov 5 00:21:55 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
# Get the python version.
$ python --version
Python 3.12.3
# Get the docker version and other docker information.
$ docker info
Client: Docker Engine - Community
 Version:    29.3.0
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.31.1
    Path:     /usr/libexec/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v5.1.0
    Path:     /usr/libexec/docker/cli-plugins/docker-compose

Server:
 Containers: 39
  Running: 0
  Paused: 0
  Stopped: 39
 Images: 58
 Server Version: 29.3.0
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Using metacopy: false
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 1
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
 CDI spec directories:
  /etc/cdi
  /var/run/cdi
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 301b2dac98f15c27117da5c8af12118a041a31d9
 runc version: v1.3.4-0-gd6d73eb8
 init version: de40ad0
 Security Options:
  seccomp
   Profile: builtin
 Kernel Version: 5.15.167.4-microsoft-standard-WSL2
 Operating System: Ubuntu 24.04.4 LTS
 OSType: linux
 Architecture: x86_64
 CPUs: 14
 Total Memory: 15.36GiB
 Name: LT-1H845226VB
 ID: 18f66b59-6bdf-40f1-9ec0-053c4c72ef7b
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Experimental: false
 Insecure Registries:
  ::1/128
  127.0.0.0/8
 Live Restore Enabled: false
 Firewall Backend: iptables

WARNING: No blkio throttle.read_bps_device support
WARNING: No blkio throttle.write_bps_device support
WARNING: No blkio throttle.read_iops_device support
WARNING: No blkio throttle.write_iops_device support
WARNING: Support for cgroup v1 is deprecated and planned to be removed by no later than May 2029 (https://github.com/moby/moby/issues/51111)
# Get all python packages.
$ pip list
alabaster                       1.0.0
anyio                           4.12.1
asn1crypto                      1.5.1
babel                           2.17.0
backrefs                        6.1
bcrypt                          5.0.0
bracex                          2.6
cassandra-driver                3.29.3
certifi                         2026.1.4
cffi                            2.0.0
cfgv                            3.5.0
charset-normalizer              3.4.4
click                           8.3.1
colorama                        0.4.6
coverage                        7.13.1
cryptography                    46.0.3
decorator                       5.2.1
deprecated                      1.3.1
distlib                         0.4.0
docker                          7.1.0
docutils                        0.22.4
fabric                          3.2.2
filelock                        3.20.3
geomet                          1.1.0
ghp-import                      2.1.0
greenlet                        3.3.0
grpcio                          1.76.0
hvac                            2.4.0
id                              1.5.0
identify                        2.6.16
idna                            3.11
imagesize                       1.4.1
iniconfig                       2.3.0
invoke                          2.2.1
jaraco-classes                  3.4.0
jaraco-context                  6.1.0
jaraco-functools                4.4.0
jeepney                         0.9.0
jinja2                          3.1.6
kafka-python-ng                 2.2.3
keyring                         25.7.0
librt                           0.7.8
markdown                        3.10.1
markdown-it-py                  4.0.0
markupsafe                      3.0.3
mdurl                           0.1.2
mergedeep                       1.3.4
mkdocs                          1.6.1
mkdocs-codeinclude-plugin       0.2.1
mkdocs-get-deps                 0.2.0
mkdocs-include-markdown-plugin  7.2.0
mkdocs-markdownextradata-plugin 0.2.6
mkdocs-material                 9.7.1
mkdocs-material-extensions      1.3.1
more-itertools                  10.8.0
mypy                            1.19.1
mypy-extensions                 1.1.0
nh3                             0.3.2
nodeenv                         1.10.0
numpy                           2.4.1
orjson                          3.11.5
packaging                       25.0
paginate                        0.5.7
paho-mqtt                       2.1.0
pandas                          2.3.3
paramiko                        4.0.0
pathspec                        1.0.3
pg8000                          1.31.5
platformdirs                    4.5.1
pluggy                          1.6.0
pre-commit                      4.5.1
protobuf                        6.33.4
psycopg                         3.3.2
psycopg2-binary                 2.9.11
pycparser                       2.23
pygments                        2.19.2
pymdown-extensions              10.20.1
pymilvus                        2.6.6
pynacl                          1.6.2
pytest                          9.0.2
pytest-asyncio                  1.3.0
pytest-cov                      7.0.0
pytest-mock                     3.15.1
python-dateutil                 2.9.0.post0
python-dotenv                   1.2.1
pytz                            2025.2
pyyaml                          6.0.3
pyyaml-env-tag                  1.1
readme-renderer                 44.0
requests                        2.32.5
requests-toolbelt               1.0.0
rfc3986                         2.0.0
rich                            14.2.0
roman-numerals                  4.1.0
ruff                            0.14.13
scramp                          1.4.8
secretstorage                   3.5.0
setuptools                      80.9.0
six                             1.17.0
snowballstemmer                 3.0.1
sphinx                          9.1.0
sphinxcontrib-applehelp         2.0.0
sphinxcontrib-devhelp           2.0.0
sphinxcontrib-htmlhelp          2.1.0
sphinxcontrib-jsmath            1.0.1
sphinxcontrib-qthelp            2.0.0
sphinxcontrib-serializinghtml   2.0.0
sqlalchemy                      2.0.45
sqlalchemy-cockroachdb          2.0.3
testcontainers                  4.14.2         /home/johny/tmp/testcontainers-python
tomli                           2.4.0
twine                           6.2.0
types-paramiko                  4.0.0.20250822
typing-extensions               4.15.0
tzdata                          2025.3
urllib3                         2.6.3
virtualenv                      20.36.1
watchdog                        6.0.0
wcmatch                         10.1
wrapt                           2.0.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions