-
Notifications
You must be signed in to change notification settings - Fork 308
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
fix(core): Typing in docker_client #702
base: main
Are you sure you want to change the base?
fix(core): Typing in docker_client #702
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #702 +/- ##
=======================================
Coverage ? 84.97%
=======================================
Files ? 12
Lines ? 679
Branches ? 106
=======================================
Hits ? 577
Misses ? 79
Partials ? 23 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Please note: core/testcontainers/core/config.py:46: error: X | Y syntax for unions requires Python 3.10 [syntax]
connection_mode: str | None = environ.get("TESTCONTAINERS_CONNECTION_MODE") Found when rebasing and updated to support 3.9 (I'm not aware of deprecating 3.9 in tc-python, feel free to update) |
@alexanderankin @kiview can you please rerun this? (I assume this was an issue with the docker registry) |
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.
Please use cast
only when required (i.e. for dict[str, Any]
).
If possible always improve the runtime type safety.
core/testcontainers/core/config.py
Outdated
@@ -19,7 +19,7 @@ def use_mapped_port(self) -> bool: | |||
|
|||
This is true for everything but bridge mode. | |||
""" | |||
if self == self.bridge_ip: | |||
if cast(str, self) == self.bridge_ip: |
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.
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.
@CarliJoy Mypy seems to disagree:
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.
Update to latest mypy, still the same behavior
mypy 1.15.0 (compiled: yes)
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.
Found the issue :)
under "[tool.mypy]" on pyproject.toml
we have strict = true
I'll be adding # type: ignore[comparison-overlap]
in the relevant locations (future PRs) @CarliJoy
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.
Fixed
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.
if self == ConnectionMode.bridge_ip:
Seems to be the type correct solution.
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.
Will fix after #807 as it also touch this part :)
f4b0d0a
to
59372c6
Compare
@CarliJoy Updated with all of the Fixes |
Supports: #305
Related : #691 #692 #700
Based on #504, kudos @alexanderankin
Old
New