testcontainers / testcontainers-python

Testcontainers is a Python library that providing a friendly API to run Docker container. It is designed to create runtime environment to use during your automatic tests.
https://testcontainers-python.readthedocs.io/en/latest/
Apache License 2.0
1.58k stars 288 forks source link

feat(compose): ability to retain volumes when using context manager #659

Closed totallyzen closed 3 months ago

totallyzen commented 3 months ago

changes

On fiddling with a local project of mine, I realised we default to removing volumes when using compose. This is neat, but the context manager should also allow control over the volumes kept.

This change adds the keep_volumes flag and hooks into self.stop() that already had the option.

I added a test to cover the new functionality :green_heart: