avast / pytest-docker

Docker-based integration tests
MIT License
427 stars 71 forks source link

Provide fixture for docker cleanup command #51

Closed vschmidt94 closed 4 years ago

vschmidt94 commented 4 years ago

Allows user to override fixture to provide alternate clean-up command for docker_compose.

vschmidt94 commented 4 years ago

Use case here:

By providing the user the option to customize the clean-up via a test fixture, this will allow user to use their own strategies as needed.

vschmidt94 commented 4 years ago

@Luminaar - will do, but expect a ~ 1 week delay. I need to follow internal policy and get approval before this goes in, since it was developed 'on company time'.

nejch commented 4 years ago

Sorry to jump in here, I found this PR looking for the exact same feature. I think this should be configurable with a pytest option so that the user can choose whether or not to reuse containers (e.g. CI vs local execution).

See how pytest-docker-compose (which seems less active now though) is doing this for a complete solution: docs: https://github.com/pytest-docker-compose/pytest-docker-compose/#use-wider-scoped-fixtures code https://github.com/pytest-docker-compose/pytest-docker-compose/blob/develop/src/pytest_docker_compose/__init__.py#L124

But I'd be happy to open a separate PR for this later if you think it's out of scope.

vschmidt94 commented 4 years ago

@nejch, I think the --use-running-containers type flag is a good addition as well, but probably deserves its own PR, at least IMO. I may take a swing at that as well once I get cleared on this one.

nejch commented 4 years ago

Ok, no worries I'll follow this and open a separate PR later if needed, thanks! :)

vschmidt94 commented 4 years ago

@Luminaar - Apologies for taking so long to fix up, but ran into issues getting official approval due to key people out of office and needing their approval.

Luminaar commented 4 years ago

@nejch I feel that both this PR and what you propose are valuable features. I will gladly accept a PR if you drafted one