Skip to content
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

Merged

Conversation

oliverlambson
Copy link
Contributor

@oliverlambson oliverlambson commented May 27, 2024

Fixes #587

@@ -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}"
Copy link
Contributor Author

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

Copy link
Collaborator

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.

Copy link

codecov bot commented Jun 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Please upload report for BASE (main@a962147). Learn more about missing BASE report.

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.
📢 Have feedback on the report? Share it here.

@alexanderankin alexanderankin merged commit 01d6c18 into testcontainers:main Jun 28, 2024
15 checks passed
@oliverlambson oliverlambson deleted the fix/postgres-get-url branch June 28, 2024 18:41
Tranquility2 pushed a commit to Tranquility2/testcontainers-python that referenced this pull request Jun 30, 2024
alexanderankin pushed a commit that referenced this pull request Jul 2, 2024
🤖 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: PostgresContainer().get_connection_url(driver=None) does not function as documented
3 participants