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 — fix(core): Use WaitStrategy internally for wait_for function by pmorch · Pull Request #942 · testcontainers/testcontainers-python

Conversation

@pmorch

@pmorch pmorch commented Dec 27, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

fix(core): Use WaitStrategy internally for wait_for function

Summary

Refactor the deprecated wait_for function to use the new WaitStrategy system internally instead of the @wait_container_is_ready decorator.

This fixes the import-time deprecation warning from #874.

See alexanderankin's comment stating core should no longer warn, and jonaslb's reply identifying that wait_for is still decorated with @wait_container_is_ready at module level, so it generates a warning.

Problem

The wait_for function was decorated with @wait_container_is_ready(), which emits a deprecation warning at decoration time (import time), not when the function is called. This caused warnings even when users never used wait_for.

Reproducer

mkdir /tmp/reproduce && cd /tmp/reproduce
echo 'import testcontainers.core.waiting_utils
def test_import(): pass' > test_import.py
uv run --with testcontainers --with pytest pytest test_import.py
=============================== warnings summary ===============================
waiting_utils.py:215: DeprecationWarning: The @wait_container_is_ready decorator
  is deprecated and will be removed in a future version...
    @wait_container_is_ready()

1 passed, 1 warning

Note: wait_for is never called - the warning is emitted just by importing the module.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

rirze and Hugo-C reacted with hooray emoji
All reactions
  • 🎉 2 reactions
@codecov

codecov Bot commented Jan 19, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.96%. Comparing base (183e1aa) to head (3949ffa).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
core/testcontainers/core/waiting_utils.py 0.00% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #942      +/-   ##
==========================================
- Coverage   78.30%   77.96%   -0.34%     
==========================================
  Files          14       14              
  Lines        1212     1216       +4     
  Branches      141      142       +1     
==========================================
- Hits          949      948       -1     
- Misses        222      227       +5     
  Partials       41       41              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@pmorch @alexanderankin
fix(core): Use WaitStrategy internally for wait_for function
3949ffa
Refactor the deprecated wait_for function to use the new WaitStrategy system
internally instead of the @wait_container_is_ready decorator.

The decorator emitted a deprecation warning at decoration time (import time),
causing warnings even when users never called wait_for.

Replace with an internal CallableWaitStrategy that uses WaitStrategy._poll()
for retry logic. This follows the intended migration path to the new system.

Fixes testcontainers#874
@alexanderankin
alexanderankin force-pushed the fix/core-wait-for-deprecated-decorator branch from 05b816e to 3949ffa Compare January 19, 2026 17:34
alexanderankin
alexanderankin approved these changes Jan 19, 2026
View reviewed changes
@alexanderankin
alexanderankin merged commit e323317 into testcontainers:main Jan 19, 2026
6 of 8 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot mentioned this pull request Jan 19, 2026
chore(main): release testcontainers 4.14.1 #954
Merged
alexanderankin pushed a commit that referenced this pull request Jan 31, 2026
@github-actions
chore(main): release testcontainers 4.14.1 (#954)
17eb0b0
🤖 I have created a release *beep* *boop*
---


##
[4.14.1](testcontainers-v4.14.0...testcontainers-v4.14.1)
(2026-01-31)


### Bug Fixes

* Allow passing in a custom wait strategy string in MySQL, Cassandra,
Kafka and Trino
([#953](#953))
([be4d09e](be4d09e))
* **compose:** expose useful compose options
([#951](#951))
([183e1aa](183e1aa))
* **core:** bring back dind tests
([7337266](7337266))
* **core:** Use WaitStrategy internally for wait_for function
([#942](#942))
([e323317](e323317))
* **nats:** add support for jetstream
([#938](#938))
([49c9af8](49c9af8))
* Support Elasticsearch 9.x
([#881](#881))
([f690e88](f690e88)),
closes
[#860](#860)

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@alexanderankin alexanderankin alexanderankin approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@pmorch @alexanderankin
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.