-
-
Notifications
You must be signed in to change notification settings - Fork 50
Moved tests to using testcontainers #232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
SubhadityaMukherjee
wants to merge
11
commits into
openml:main
Choose a base branch
from
SubhadityaMukherjee:tests_to_testcontainers
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 9 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
1629117
moved tests to testcontainers
SubhadityaMukherjee f90cbf1
Merge branch 'openml:main' into tests_to_testcontainers
SubhadityaMukherjee 467b614
cleanup pointless changes
SubhadityaMukherjee 078fc07
Oops a message got deleted by mistake
SubhadityaMukherjee bd2c356
fixed a bug with testcontainers
SubhadityaMukherjee a642e66
fixed a bug with testcontainers
SubhadityaMukherjee cac21e8
Merge branch 'main' into tests_to_testcontainers
PGijsbers 64c6067
Merge branch 'main' into tests_to_testcontainers
PGijsbers f08d49d
Update to use new database image
PGijsbers 29b09c7
split into local and testcontainer tests
SubhadityaMukherjee 2e8b265
minor change to the argument parsing
SubhadityaMukherjee File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
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.
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.
🛠️ Refactor suggestion | 🟠 Major
🧩 Analysis chain
🌐 Web query:
testcontainers-python MySqlContainer wait strategy customize public API💡 Result:
In testcontainers-python,
MySqlContainerdoesn’t expose a Java-style “wait strategy” hook on the class itself; the public API for customizing readiness is via the waiting utilities (log-based waiting) and/or by subclassing and overriding the connection check.1) Log-based waiting (public API)
Use
testcontainers.core.waiting_utils.wait_for_logs(container, predicate, timeout=None, interval=1)after the container is started (or inside a custom container’s startup flow). The predicate can be a regex string or a callable. The function supportstimeoutandinterval. [1]MySqlContaineritself is the standard MySQL wrapper you’re already using. [2]2) Connection-based waiting via
@wait_container_is_ready(public API)If you want “wait until I can connect” semantics (common for DBs), subclass
MySqlContainerand decorate your_connect()withwait_container_is_ready(...)so failures are retried until success/timeout. [3]3) Tuning retry/timeout behavior
Retry limits/sleep/timeout for readiness waiting are controlled via
testcontainers_config(global configuration). [3]Sources: [1] [2] [3]
Use
wait_for_logs()or subclass with@wait_container_is_ready()instead of monkey-patching_connect.Line 36 overrides a private method, which breaks on testcontainers-python upgrades if internals change. testcontainers-python provides public APIs:
wait_for_logs(): Call after container startup with a regex predicate for log-based readiness@wait_container_is_ready()decorator: Override_connectin a subclass with the decorator to handle retry logic safelyExample using
wait_for_logs:🤖 Prompt for AI Agents