-
Notifications
You must be signed in to change notification settings - Fork 339
Closed
Description
Describe the bug
waiting_for currently is annotated as returning "DockerContainer", but it really should be annotated as returning Self.
This is important because the incorrect annotation loses type information.
To Reproduce
Most type checkers will complain about assigning a DockerContainer to a variable of type MySqlContainer because of this
container: MySqlContainer = MySqlContainer("mysql:5.6", root_password="root").waiting_for(
CompositeWaitStrategy(
PortWaitStrategy(3306),
LogMessageWaitStrategy("mysqld: ready for connections"),
)
)
Runtime environment
$ uname -a
Linux DESKTOP-971PGRM 6.6.87.2-microsoft-standard-WSL2 #1 SMP PREEMPT_DYNAMIC Thu Jun 5 18:30:46 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
$ python3 -V
Python 3.12.7
$ pip list | grep testcontainers
testcontainers 4.13.1
Checkers such as Astral's ty
and pyright complain.
Metadata
Metadata
Assignees
Labels
No labels