-
Notifications
You must be signed in to change notification settings - Fork 301
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
feat(core): DockerCompose.stop now stops only services that it starts (does not stop the other services) #620
Conversation
…esent. The command would otherwise stop/down all services, not just the services the instance itself started. Useful for e.g. one fixture per service, and you want different scopes for the services.
Apologies if my PR breaks any conventions or contribution guidelines. I was a bit confused by the docs, as they seemed to be targeted towards contributing features, which I don't think this is. Let me know if I should close, resubmit, or change anything Thanks! 😄 |
My specific use case is this: import pytest
from testcontainers.compose import DockerCompose
@pytest.fixture(scope="session")
async def aws() -> DockerCompose:
with DockerCompose(
".",
compose_file_name="docker-compose.yaml",
pull=True,
build=True,
services=["aws"],
# Wait for localstack to be healthy
wait=True,
) as compose:
yield compose
@pytest.fixture(scope="module")
async def db(aws) -> DockerCompose:
with DockerCompose(
".",
compose_file_name="docker-compose.yaml",
pull=True,
build=True,
# Only start the DB
services=["db"],
# Wait for the DB to be healthy
wait=True,
) as compose:
yield compose Starting up |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #620 +/- ##
=======================================
Coverage ? 80.29%
=======================================
Files ? 11
Lines ? 604
Branches ? 86
=======================================
Hits ? 485
Misses ? 92
Partials ? 27 ☔ View full report in Codecov by Sentry. |
🤖 I have created a release *beep* *boop* --- ## [4.7.0](testcontainers-v4.6.0...testcontainers-v4.7.0) (2024-06-28) ### Features * **core:** Added Generic module ([#612](#612)) ([e575b28](e575b28)) * **core:** allow custom dockerfile path for image build and bypassing build cache ([#615](#615)) ([ead0f79](ead0f79)), closes [#610](#610) * **core:** DockerCompose.stop now stops only services that it starts (does not stop the other services) ([#620](#620)) ([e711800](e711800)) ### Bug Fixes * **ollama:** Add support for ollama module ([#618](#618)) ([5442d05](5442d05)) * **cosmosdb:** Add support for the CosmosDB Emulator ([#579](#579)) ([8045a80](8045a80)) * improve ollama docs, s/ollama_dir/ollama_home/g ([#619](#619)) ([27f2a6b](27f2a6b)) * **kafka:** Add Kraft to Kafka containers ([#611](#611)) ([762d2a2](762d2a2)) ### Documentation * **contributing:** add contribution and new-container guide ([#460](#460)) ([3519f4b](3519f4b)) --- 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>
The command would otherwise stop/down all services, not just the services the instance itself started.
Useful for e.g. one fixture per service, and you want different scopes for the services.