feat(core): add mount files when starting a container #677
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I have created the issue #665 on which I proposed to implement it.
I have read the contribution guidelines.
The feature works fine, as you can see by the tests.
But I have some doubts about my solution.
I made some decisions that you may not agree with, so I'd like to have your feedback whether or not it suits you, so that I can fix this PR if required.
core/testcontainers/core/container.py
I addedfrom docker.types.services import Mount
. I noticed that thetestcontainers
package had very few imports of thedocker
package. Is it OK to do it ? Or should it be made the same way than *volumes* (i.e. do not use the type defined in the
docker.types` package, create an untyped dict instead) ?core/tests/test_core.py
I addedfrom testcontainers.core.container import docker
, whosedocker
is thedocker
package, is it OK ?core/tests/test_core.py
test file. Is it OK to add all of them ?DockerContainer.with_copy_file_to_container
incore/testcontainers/core/container.py
) accepts its paths arguments as bothstr
andpathlib.Path
(thanks toUnion
). I think it makes for better APIs (because there is no need to convert before to call them, they handle it). But that was not the way it was done in the rest of the file. Is it OK to do it like that ? Or should I change to accept onlystr
s ?Thanks in advance 😃