GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — bug: community modules using old decorators print deprecation warnings · Issue #874 · testcontainers/testcontainers-python

bug: community modules using old decorators print deprecation warnings #874

New issue
Copy link
New issue
Copy link
Closed
#1013
#1004
Closed
bug: community modules using old decorators print deprecation warnings#874
#1013
#1004
Copy link

Description

@DarthMax
DarthMax
opened on Sep 11, 2025
Issue body actions

It seems that the 4.13 release introduced a new deprecation warning around the @wait_container_is_ready decorator.

The deprecation warning itself works as expected and the description is comprehensive.
There is a problem however: importing DockerContainer will cause the deprecation warning to appear with the following stack trace:

conftest.py:6: in <module>
    from testcontainers.core.container import DockerContainer
project/venv/lib/python3.13/site-packages/testcontainers/core/container.py:21: in <module>
    from testcontainers.core.wait_strategies import LogMessageWaitStrategy
project/venv/lib/python3.13/site-packages/testcontainers/core/wait_strategies.py:41: in <module>
    from .waiting_utils import WaitStrategy, WaitStrategyTarget
project/venv/lib/python3.13/site-packages/testcontainers/core/waiting_utils.py:178: in <module>
    @wait_container_is_ready()
project/venv/lib/python3.13/site-packages/testcontainers/core/waiting_utils.py:117: in wait_container_is_ready
    warnings.warn(
E   DeprecationWarning: The @wait_container_is_ready decorator is deprecated and will be removed in a future version. Use structured wait strategies instead: container.waiting_for(HttpWaitStrategy(8080).for_status_code(200)) or container.waiting_for(LogMessageWaitStrategy('ready'))

Our project is configured to treat warnings as errors. As far as I am aware, there is currently nothing we can do on the consumer side to prevent this issues.

As a side note, the documentation still mentions the wait_for_logs method:
https://testcontainers-python.readthedocs.io/en/latest/core/README.html

To Reproduce

from testcontainers.core.container import DockerContainer
template details

Runtime environment

Provide a summary of your runtime environment. Which operating system, python version, and docker version are you using? What is the version of testcontainers-python you are using? You can run the following commands to get the relevant information.

# Get the operating system information (on a unix os).
$ uname -a
Linux computer 6.16.5-arch1-1 #1 SMP PREEMPT_DYNAMIC Thu, 04 Sep 2025 23:18:13 +0000 x86_64 GNU/Linux
# Get the python version.
$ python --version
Python 3.13.7
# Get the docker version and other docker information.
$ docker info
Client:
 Version:    28.3.3
 Context:    default
 Debug Mode: false
 Plugins:
  compose: Docker Compose (Docker Inc.)
    Version:  2.39.2
    Path:     /usr/lib/docker/cli-plugins/docker-compose

Server:
 Containers: 18
  Running: 0
  Paused: 0
  Stopped: 18
 Images: 89
 Server Version: 28.3.3
 Storage Driver: overlay2
  Backing Filesystem: btrfs
  Supports d_type: true
  Using metacopy: true
  Native Overlay Diff: false
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: systemd
 Cgroup Version: 2
 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: 75cb2b7193e4e490e9fbdc236c0e811ccaba3376.m
 runc version: 
 init version: de40ad0
 Security Options:
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 6.16.5-arch1-1
 Operating System: Arch Linux
 OSType: linux
 Architecture: x86_64
 CPUs: 22
 Total Memory: 62.23GiB
 Name: kaylee
 ID: 255a32ed-e357-4e07-be9f-c97413711ef9
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Experimental: false
 Insecure Registries:
  ::1/128
  127.0.0.0/8
 Live Restore Enabled: false
Reacted by Michele Bianchi, johnniemorrow, an5t, Juuso Palander, porn, Jackson Smith, Antonio Bares, Stéphanie, Alex Hall, Jon Menard and 22 more

Activity

Next
  1. antonio-carapcea-softwire commented on Sep 15, 2025

    @antonio-carapcea-softwire
    antonio-carapcea-softwire
    on Sep 15, 2025
    More actions

    We get this as well just by using testcontainers in a fixture.

    Reacted by Diego Rodrigues, sentient6, dudustri, Mike Lui, Jonas Lundholm Bertelsen, Günther Grill and Alexey Shokov
  2. mitch-karch commented on Sep 21, 2025

    @mitch-karch
    mitch-karch
    on Sep 21, 2025 · Hidden as off-topic
    show commentMore actions
  3. johnniemorrow commented on Sep 21, 2025

    @johnniemorrow
    johnniemorrow
    on Sep 21, 2025 · Hidden as off-topic
    show commentMore actions
  4. dbogdoll commented on Sep 23, 2025

    @dbogdoll
    dbogdoll
    on Sep 23, 2025 · Hidden as off-topic
    show commentMore actions
  5. alexanderankin commented on Sep 23, 2025

    @alexanderankin
    alexanderankin
    on Sep 23, 2025
    Member
    More actions

    yep, we upgraded core to use a sane abstraction and still need to update the community modules. deprecation warnings are ok, they communicate that something is going away, not that it is broken.

    Reacted by sentient6
    Reacted by porn
  6. porn commented on Sep 23, 2025

    @porn
    porn
    on Sep 23, 2025 · Hidden as off-topic
    show commentMore actions
  7. alexanderankin
    changed the title [-]Bug: 4.13 - Deprecation Warning for `@wait_container_is_ready decorator is deprecated`[/-] [+]bug: community modules using old decorators print deprecation warnings[/+] on Sep 23, 2025
  8. fan9704 commented on Sep 23, 2025

    @fan9704
    fan9704
    on Sep 23, 2025 · Hidden as off-topic
    show commentMore actions
  9. dudustri commented on Oct 3, 2025

    @dudustri
    dudustri
    on Oct 3, 2025
    More actions

    well, apparently if you call the test container in general during import time it will break your module due to the warning for newer python versions 3.12 or above (tighten restriction of deprecation). I would recommend to downgrade the test containers package in this meanwhile since I couldn't figure out how to make it work either with a lazy instantiation or module import. I think it is happening with most of the test containers if not all. In my case it happened with Redis, MySQL, regular docker and Arango.

    Does someone have a workaround for it while the guys are on a wip with the community modules?

  10. alexanderankin commented on Oct 3, 2025

    @alexanderankin
    alexanderankin
    on Oct 3, 2025
    Member
    More actions

    is there any reference or example I can look at for python 3.12 deprecation behavior? this is something I was not aware of, and changes the severity of this bug.

    Just to be clear, if someone is treating warnings as errors in their code, and they do not have the ability to turn this off for libraries, that is their problem and i am not going to fix it. (Can't, also - won't).

    But if there is some kind of mechanism built into python that treats warnings as errors, and basically CPython is forcing all of us to treat warnings as errors in some particular context that is not easy to work around, then we will adjust testcontainers to communicate deprecations in a way which is not sabotaged by the language itself.

    my goal is to communicate that a deprecated API is in use, not to make it really annoying to use the deprecated API. I am fully aware of when sometimes it is appropriate to use a deprecated API.

  11. alexanderankin commented on Oct 3, 2025

    @alexanderankin
    alexanderankin
    on Oct 3, 2025
    Member
    More actions

    edited to clarify i mean to ask about python treating warnings as errors. does python do this or is this just a thing people do in projects. people should not do this in projects. but if python itself does this, ill work around that somehow here.

  12. DarthMax commented on Oct 3, 2025

    @DarthMax
    DarthMax
    on Oct 3, 2025
    Author
    More actions

    I do not think this is something Python does in general. In our project we have a build that runs with that setting, so that we are notified about new deprecations.
    The problem with this situation, is that there is nothing we can do to get rid of the deprecation.
    As I initially described, we are not using a community module but simply import DockerContainer.

  13. mitch-karch commented on Oct 3, 2025

    @mitch-karch
    mitch-karch
    on Oct 3, 2025
    More actions

    Just for fun, I have this in my pyproject.toml to help suppress this specifically for my test cases

    [tool.pytest.ini_options]
    filterwarnings = [
        "ignore:^The @wait_container_is_ready decorator:DeprecationWarning"
    ]
    Reacted by dudustri, Hugo-C, Jonas Lundholm Bertelsen, Nastasiu Stefan, Danek Duvall, Nep Nep and Gabriel Kollet
    Reacted by Max Kießling, Adam Parr and Nep Nep
  14. mschmitzer
    added 2 commits that reference this issue on Oct 9, 2025

    fix(minio): Use wait strategy instead of deprecated decorator

    79bff0f

    fix(minio): Use wait strategy instead of deprecated decorator

    3903509
  15. 12 remaining items

  16. alexanderankin
    added 2 commits that reference this issue on Jan 19, 2026

    fix(core): Use WaitStrategy internally for wait_for function

    3949ffa

    fix(core): Use WaitStrategy internally for wait_for function (#942)

    e323317
  17. markhobson
    added a commit that references this issue on Feb 17, 2026

    GH-68: Upgrade Testcontainers to 4.14.x

    ad8c553
  18. mschmitzer
    added a commit that references this issue on Feb 25, 2026

    fix(redis): Use wait strategy instead of deprecated decorator

    221f3b2
  19. alexanderankin
    added 6 commits that reference this issue on Apr 1, 2026

    fix(generic): Migrate ServerContainer from deprecated decorator to Ht…

    460b0d8

    fix(kafka): Use wait strategy instead of deprecated wait_for_logs (#903)

    87332c1

    fix(redis): Use wait strategy instead of deprecated decorator

    732f8bd

    fix(clickhouse): add `HttpWaitStrategy` instead of deprecated `wait_c…

    8034541

    fix(redis): Use wait strategy instead of deprecated decorator (#914)

    e25713a

    fix(azurite): use `HttpWaitStrategy` instead of deprecated `wait_cont…

    9fe6b07
  20. alexanderankin
    closed this as completedin #1004on Apr 30, 2026
  21. alexanderankin
    added a commit that references this issue on Apr 30, 2026

    chore(main): release testcontainers 4.15.0-rc2 (#1004)

    79d920e
  22. alexanderankin
    added a commit that references this issue on May 22, 2026

    fix(mssql): use `ExecWaitStrategy` instead of deprecated `wait_contai…

    4c53b89
  23. alexanderankin
    added 2 commits that reference this issue on Jun 3, 2026

    fix(mongodb): Use wait strategy instead of deprecated wait_for_logs (#…

    c8118e7

    chore(main): release testcontainers 4.15.0-rc3 (#1013)

    3cbd956
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.