avast / pytest-docker

Docker-based integration tests
MIT License
406 stars 68 forks source link

Allow user to customize `docker-compose up` command line flags #63

Closed kennysong closed 2 years ago

kennysong commented 2 years ago

When pytest is run, it launches the Docker Compose services with docker_compose.execute("up --build -d").

A problem with this is: for our application, we'd need to run docker_compose.execute("build && docker-compose up -d") to actually build it properly (because docker-compose --build up follows the depends_on order for the build, which doesn't work in our case).

I think adding a new fixture like docker_setup(), similar to docker_cleanup(), would be a great way of allowing this customization (as suggested here for a different issue).

kennysong commented 2 years ago

It's also useful for redirecting build logs that would otherwise be hidden: docker_compose.execute("build &> /tmp/build_logs.txt && docker-compose up -d")

ignapas commented 2 years ago

This would also allow the use of the --profiles flag and feature which we do in our project.

Luminaar commented 2 years ago

Version 0.12.0 adds a way to customize docker-compose setup.