- Notifications
You must be signed in to change notification settings - Fork 355
Add CustomContainer exposing settings through the class#238
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
Uh oh!
There was an error while loading. Please reload this page.
Conversation
vikahl commented Aug 25, 2022 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
tillahoffmann commented Aug 25, 2022
Great, thank you! Slight misunderstanding: I was thinking that we could add this functionality to existing containers rather than create a new one. What do you think? |
vikahl commented Aug 25, 2022
I don't there is any current class (except for the deprecated |
tillahoffmann commented Aug 25, 2022
The image name can be specified for testcontainers-python/testcontainers/core/container.py Lines 12 to 13 in 7346345
|
vikahl commented Aug 25, 2022
True, you have a point there. Just to clarify, do you suggest extending the I think the DockerContainer approach would be convenient and won't require a new class. I can test the approach tomorrow and see if it would impact existing implementations. |
tillahoffmann commented Aug 30, 2022
I was thinking all the containers as they all inherit from |
vikahl commented Mar 16, 2023
Ah, good thought. Sorry for not picking up on this but I'll update the PR. |
6e3291a to 8622477Comparevikahl commented Mar 22, 2023
@tillahoffmann updated the PR to instead set these in the core container's If so, I'll make sure these changes are covered by tests as well. |
gaby commented Jun 8, 2023
Ping @tillahoffmann this is another great PR |
tillahoffmann left a comment
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.
Looks good, I left a few small comments. If you could add tests, that'd be great! 🙏
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
vikahl commented Jun 9, 2023
Will take a look and add tests and do the updates when I am back at a computer (might take a few weeks) |
ac8b58f to 2c4eb3bCompareAdd test that tests that attributes can be set through the __init__ function and later read through class attr. This test does not test that the attributes has an actual effect, in the future it might be of interest to test the integration to the docker container and ensure that class attributes are propagated properly.
vikahl commented Jun 27, 2023
@tillahoffmann please take a look at the tests. I added test that tests that attributes can be set through the init function and later read through class attr. The test does not test that the attributes has an actual effect, in the future it might be of interest to test the integration to the docker container and ensure that class attributes are propagated properly. However, I for the changes in this PR I think the current is good enough. |
rhoban13 commented Apr 2, 2025
This PR seems to have stalled, but is a really good idea. What do we need to do to get it over the finish line? |
| self.env={} | ||
| self.ports={} | ||
| self.volumes={} | ||
| def__init__( |
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.
Can we do the same with network and network_aliases? I suspect we need to rebase this PR in order to pickup these attributes.
vikahl commented Apr 2, 2025
It's been a while, but it's still a feature I would like to have (now I use a |
rhoban13 commented Apr 11, 2025
Let me know if I can help - I can attempt a rebase and PR your branch or honestly your idea of just resubmitting might be just as easy. |
Tranquility2 commented Apr 11, 2025 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
Hi @vikahl and @rhoban13, we had this talk or similar notion/idea on #559, we ended up with https://github.com/testcontainers/testcontainers-python/blob/main/modules/generic/testcontainers/generic/server.py which emphasis the notion to do custom stuff as a module (outside of core). |
rhoban13 commented Apr 12, 2025
I might suggest resubmitting this PR separately as the original intent sounds just like the |
rhoban13 commented May 6, 2025
I resubmitted as the above PR on an updated branch in hopes of getting it landed. I'm not sure who I need to reach out to to kick off the validations and get a review. |
alexanderankin commented May 6, 2025
prefer #809 but will leave both open until i have time to review + merge |
vikahl commented May 6, 2025
…args (#809) Re submitting what is the end result of the iterations in #238 submitted originally by @vikhal. Simply enabling the initializer of `DockerContainer` to accept its private members as kwargs. --------- Co-authored-by: David Ankin <[email protected]>
…args (testcontainers#809) Re submitting what is the end result of the iterations in testcontainers#238 submitted originally by @vikhal. Simply enabling the initializer of `DockerContainer` to accept its private members as kwargs. --------- Co-authored-by: David Ankin <[email protected]>
Add a
CustomContainerexposing the settings through the class.Close#236