Comments (5)
Having scope=module on the other hand is useful to run a battery of tests against a set of environments defined in the same file. At least it's a better fit for my use case, otherwise I have to run pytest multiple times.
from pytest-docker.
@mmetc in that case, it'd be better to allow the flag to be set to the desired scope directly, so something like
def pytest_addoption(parser):
parser.addoption(
"--containers-scope",
type=str,
default="function"
help="The pytest fixture scope for reusing containers between tests. For available scopes and descriptions, see https://docs.pytest.org/en/6.2.x/fixture.html#fixture-scopes",
)
@pytest.fixture
def containers_scope_fixture(request):
return request.config.getoption("--containers-scope")
def containers_scope(fixture_name, config):
return config.getoption("--containers-scope-fixture", "function"):
@pytest.fixture(scope=containers_scope)
# This annotation can apply to all fixtures, instead of the hard-coded "session" scope
from pytest-docker.
Having scope=module on the other hand is useful to run a battery of tests against a set of environments defined in the same file. At least it's a better fit for my use case, otherwise I have to run pytest multiple times.
That is true, but sometimes I need different compose.yaml configs for different set of tests. If I haven't got different scopes, I need to run pytest for each set of tests needing the same docker-compose yaml.
from pytest-docker.
I would've expected a function scope to be the default, are there any blockers to implementing this?
from pytest-docker.
Related Issues (20)
- Allow user to customize `docker-compose up` command line flags HOT 3
- Unable to run in CI pipeline HOT 2
- `"docker-compose-v1": executable file not found in $PATH` when running from Makefile HOT 2
- How to add parametrize to our test case with pytest-docker? HOT 1
- Docs for multiple docker-compose files HOT 4
- Version Conflict with PyYAML 6.0 HOT 4
- Support for docker-compose V2 HOT 4
- Support for pytest v7
- Endpoint empty error HOT 5
- Project maintenance and activity HOT 1
- Skipping the setup in Gitlab CI HOT 3
- Insufficient removal of control characters on windows with cmd.exe as shell HOT 2
- How to wait for container to become healthy? HOT 3
- same set of tests, many docker-compose.yml? HOT 1
- Fixture `docker_ip` not found HOT 5
- Utility to run arbitrary commands on a container HOT 2
- Generated docker compose command fails HOT 3
- Docker in docker HOT 4
- Executing multiple commands for `docker_setup` and `docker_cleanup` HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pytest-docker.