-
Notifications
You must be signed in to change notification settings - Fork 292
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(postgres): get_connection_url(driver=None) should return postgres://... #588
fix(postgres): get_connection_url(driver=None) should return postgres://... #588
Conversation
@@ -79,7 +79,7 @@ def get_connection_url(self, host: Optional[str] = None, driver: Optional[str] = | |||
driver. The optional driver argument to :code:`get_connection_url` overwrites the constructor | |||
set value. Pass :code:`driver=None` to get URLs without a driver. | |||
""" | |||
driver_str = self.driver if driver is _UNSET else f"+{driver}" | |||
driver_str = "" if driver is None else self.driver if driver is _UNSET else f"+{driver}" |
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 would rather self.driver
did not contain the leading +
, then this could be simpler. But I imagine that could be a breaking change if people are relying on the internals of this class
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.
Agreed. I think we can introduce a Breaking change at a later stage, as part of some larger changes to inheritance for DB containers. This only looks good for now, and I think people would expect that if you pass None
, the driver should be empty.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #588 +/- ##
=======================================
Coverage ? 76.26%
=======================================
Files ? 11
Lines ? 573
Branches ? 83
=======================================
Hits ? 437
Misses ? 110
Partials ? 26 ☔ View full report in Codecov by Sentry. |
🤖 I have created a release *beep* *boop* --- ## [4.7.1](testcontainers-v4.7.0...testcontainers-v4.7.1) (2024-07-02) ### Bug Fixes * **core:** bad rebase from [#579](#579) ([#635](#635)) ([4766e48](4766e48)) * **modules:** Mailpit Container ([#625](#625)) ([0b866ff](0b866ff)) * **modules:** SFTP Server Container ([#629](#629)) ([2e7dbf1](2e7dbf1)) * **network:** Now able to use Network without context, and has labels to be automatically cleaned up ([#627](#627)) ([#630](#630)) ([e93bc29](e93bc29)) * **postgres:** get_connection_url(driver=None) should return postgres://... ([#588](#588)) ([01d6c18](01d6c18)), closes [#587](#587) * update test module import ([#623](#623)) ([16f6ca4](16f6ca4)) --- 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>
Fixes #587