Giter Site home page Giter Site logo

pytest-docker-fixtures's Introduction

Introduction

Provide various service pytest fixtures.

Install

pip install pytest-docker-fixtures

Usages

In your conftest.py, add the following:

pytest_plugins = ['pytest_docker_fixtures']

And to use the fixtures:

def test_foobar(redis):
    pass

Available fixtures

PRs welcome!

  • cockroach (require to be installed with pip install pytest-docker-fixtures[pg])
  • es (elasticsearch)
  • etcd
  • kafka (require to be installed with pip install pytest-docker-fixtures[kafka])
  • memcached (require to be installed with pip install pytest-docker-fixtures[memcached])
  • minio
  • mysql (require to be installed with pip install pytest-docker-fixtures[mysql])
  • pg (require to be installed with pip install pytest-docker-fixtures[pg])
  • rabbitmq (require to be installed with pip install pytest-docker-fixtures[rabbitmq])
  • redis
  • stripe (stripemock)
  • emqx
  • influxdb

Configuring custom images

You can also configure custom images to use:

from pytest_docker_fixtures import images
images.configure(
    'elasticsearch',
    'docker.elastic.co/elasticsearch/elasticsearch-platinum', '6.2.4',
    env={},
    options={}
)

pytest-docker-fixtures's People

Contributors

vangheem avatar bloodbare avatar masipcat avatar nilbacardit26 avatar jotare avatar ableeb avatar sunbit avatar albertnadal avatar lferran avatar gitcarbs avatar marshalium avatar

Stargazers

Daniel Martins avatar Barabazs avatar  avatar Oleksandr Furinets avatar Tuan Tran avatar  avatar  avatar Ryan Addessi avatar Alexey Piskunov avatar Gert van Dijk avatar Ana Paula Gomes avatar Swen Wenzel avatar Andreas Motl avatar Vsevolod Poletaev avatar  avatar Julio Nascimento avatar Dmitry Dygalo avatar Nikolaus Schlemm avatar

Watchers

Neustradamus avatar Daniel Manchon avatar Eric BREHAULT avatar  avatar  avatar  avatar James Cloos avatar  avatar Roger Boixader Güell avatar Kumar Akshay avatar

pytest-docker-fixtures's Issues

Configuring custom images easily

Dear @vangheem and @masipcat,

for adding Mosquitto (#15), we tried to use the fastpath option to configure custom images [1] first. However, we found these problems when doing it like outlined within [2]:

  1. images.configure() will not create a new slot within images.settings, so we added images.settings['mosquitto'] = {} before.
  2. After we did that, we found images.configure() will also not honor the options kwarg.
  3. An any case, just adding a service definition to images.settings will not be sufficient. We also had to add a minimal image class derived from BaseImage [3] as well as the fixture function itself [4].

While we have been able to work around these issues, we might think about improving this procedure to get closer to DWIM.

With kind regards,
Andreas.

[1] https://github.com/guillotinaweb/pytest-docker-fixtures#configuring-custom-images
[2] https://github.com/hiveeyes/terkin-datalogger/blob/ccaa56d6/test/util/mosquitto.py#L8-L19
[3] https://github.com/hiveeyes/terkin-datalogger/blob/ccaa56d6/test/util/mosquitto.py#L32-L40
[4] https://github.com/hiveeyes/terkin-datalogger/blob/ccaa56d6/test/util/mosquitto.py#L43-L49

Passing configuration properties to kafka image

Dear @vangheem,

I was just looking to set some custom configuration options for Kafka image to run with.
Was trying to understand how and what all config options can I pass to the kafka image while configuring the fixture.

If you could help with any pointers for the same, that will be really helpful. Thanks in advance!

Add Mosquitto service

Dear @vangheem and @masipcat,

first things first: Thanks for conceiving and maintaining this valuable pytest fixture module.

We needed the Mosquitto service for running integration tests against and added a [WIP] at [1]. It should be improved by also integrating the MQTT client library paho-mqtt.

Unless we will be able to submit a pull request, it might serve as a starter for others.

With kind regards,
Andreas.

[1] https://github.com/hiveeyes/terkin-datalogger/blob/ccaa56d6/test/util/mosquitto.py

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.