Comments (2)
uping/downing containers can be expensive and can get out of control, do you have an API in mind to make the setting (which would default to off) explicit?
I also think we will need some form of docker management here - some default value to make sure we don't go above x amount of containers or if we want to be stricter - ensure this can't be used in parallel testing. What are your thoughts?
If this is used in parallel testing we would also have to make sure ports do not conflict.
Another thing to note - CircleCI does not support accessing upped/downed containers with the machine executor without some additional work. If this is implemented and is to be tested we will have to work around this.
from pytest-mock-resources.
The port conflict avoidance is the main building block here. Imagine we had already have mechanism for finding available ports and binding to them dynamically.
I'd imagine the interface, generally for docker-based resources might look like
create_x_fixture(container_scope='function')
where container_scope
would alter the "scope" of the container such that things within that scope would share the existing mechanism. I'm not sure if scope necessarily is the same thing as pytest scope, or if it's more like an arbitrary string and whatever shares that string shares the container
I think this would also allow an additional method of configuration like so:
pg9 = create_postgres_fixture(container_scope='function', config=PostgresConfig(image='postgres:9')
pg10 = create_postgres_fixture(container_scope='function', config=PostgresConfig(image='postgres:10')
We could add a max_single_resource_containers=4
to something, maybe a pytest config option, but if someone opts into this feature + xdist then i feel like they probably know what they're getting into. If you xdist -n 100
with a bunch of function scoped fixtures, i feel like that's on purpose and we should have no opinion about it?
Circle is the primary wrinkle here. Either we do some workaround in circle to go through machine executors, or it's just a matter of sequencing. the tests such that all tests of the same scope are executed together so it will have terminated the previous container before starting a new one (under the same port)
from pytest-mock-resources.
Related Issues (20)
- Allow specificying an image when using pmr cli HOT 4
- Make use of built-in sqlite json and strict support
- Add support for MySQL 8 HOT 5
- Exception trying to unlink pmr.json when when ran with --pmr-multiprocess-safe HOT 3
- Add Redis the CLI HOT 3
- $round operation for MongoDB HOT 2
- SQLAlchemy 2.0 Support HOT 7
- Certain schema DDL is issued only once per test but should be once per metadata
- Dependabot warning for docker subdependency HOT 3
- [Support] Tests hang when using fixture HOT 7
- Error opening connection from redshift_connector HOT 5
- Add in Left/Right UDF's for Redshift HOT 2
- No such event 'before_execute' for target '<sqlalchemy.orm.session.Session object ... HOT 4
- Support SQLAlchemy 1.4 future mode HOT 4
- Dependency on attrs package should be explicit HOT 3
- get_sqlalchemy_engine() not compatible with asyncpg HOT 5
- Allow defining run_args HOT 1
- Getting errors when using `create_redis_fixture` HOT 3
- Missing delete function in redis fixture HOT 1
- Redis Container dont start after update Docker for Desktop on windows. HOT 6
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-mock-resources.