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 — feat(core, postgres): Add RunFunctionWaitStrategy and use it in pg by jankatins · Pull Request #908 · testcontainers/testcontainers-python

Conversation

@jankatins

@jankatins jankatins commented Oct 18, 2025 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

I found no way to convert the current container.exec() based check function to any of the currently existing WaitStartegies and so I added RunFunctionWaitStrategy which can be used to convert such container.exec() based checks.

Helps with: #874
Closes: #883

Sorry, something went wrong.

Uh oh!

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

All reactions
@jankatins
jankatins force-pushed the feat/add-RunFunctionWaitStrategy-and-use-it-in-pg branch from b4ea0ee to d2b2200 Compare October 18, 2025 15:15
jankatins
jankatins commented Oct 18, 2025
View reviewed changes
Comment thread core/testcontainers/core/wait_strategies.py
result = self.func(container)
if result:
return result
except tuple(self._transient_exceptions) as e:

@jankatins jankatins Oct 18, 2025 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually found no reason why this shouldn't be a tuple already on self -> might be an nice refactoring on WaitStrategy and where it's used.

Sorry, something went wrong.

Uh oh!

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

All reactions
jankatins
jankatins commented Oct 18, 2025
View reviewed changes
Comment thread modules/postgres/testcontainers/postgres/__init__.py
]
)
if result.exit_code:
raise ConnectionError("pg_isready is not ready yet")

@jankatins jankatins Oct 18, 2025

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume that the pg_isready is some missing change in an older commit. I haven't investigated more...

Sorry, something went wrong.

Uh oh!

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

All reactions
jankatins
jankatins commented Oct 18, 2025
View reviewed changes
Comment thread core/tests/test_wait_strategies.py
return returns.pop(0)

strategy = RunFunctionWaitStrategy(func).with_poll_interval(0)
strategy.wait_until_ready(mock_container) # type: ignore[arg-type]

@jankatins jankatins Oct 18, 2025 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For some reason mypy didn't like passing in the mock and I had to add the ignore despite other places in the same file not having this problem with mock. No idea why :-(

Sorry, something went wrong.

Uh oh!

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

All reactions
@codecov

codecov Bot commented Oct 18, 2025 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.25%. Comparing base (f608df9) to head (202c8f4).
⚠️ Report is 30 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #908      +/-   ##
==========================================
+ Coverage   79.78%   80.25%   +0.46%     
==========================================
  Files          14       14              
  Lines        1182     1200      +18     
  Branches      184      186       +2     
==========================================
+ Hits          943      963      +20     
+ Misses        197      195       -2     
  Partials       42       42              

☔ 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.

@jankatins
jankatins force-pushed the feat/add-RunFunctionWaitStrategy-and-use-it-in-pg branch 3 times, most recently from 8c1e4f9 to 531934a Compare October 18, 2025 22:11
jankatins added 2 commits November 3, 2025 22:00
@jankatins
feat(core): Add RunFunctionWaitStrategy
13ce2d4
This is usefull for converting old wait_container_is_ready
which use container.exec() to check for a condition to become True.
@jankatins
fix(postgres): Convert postgres to new RunFunctionWaitStrategy
202c8f4
This gets rid of a annoying depcreation warning.
@jankatins
jankatins force-pushed the feat/add-RunFunctionWaitStrategy-and-use-it-in-pg branch from 394bc31 to 202c8f4 Compare November 3, 2025 21:00
@jankatins

jankatins commented Jan 7, 2026

Copy link
Copy Markdown
Contributor Author

I guess this can be closed after #935 was merged?

All reactions

Sorry, something went wrong.

Uh oh!

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

@alexanderankin alexanderankin closed this Apr 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

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

@jankatins @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.