Git Product home page Git Product logo

pytest-dockerpy's Introduction

System testing with pytest and docker-py: example code!

This repo contains the example code which accompanies the presentation System Testing with pytest and docker-py.

Build Status

The example code demonstrates how to use pytest and docker-py.

In this repo:

  • test_screencast.py - Example tests, one that succceds, and one that fails.
  • conftest.py - pytest plugin to run our example service
  • service - An example HTTP service, to be run by the tests

In conftest.py, pull_image demonstrates how to pull an image and check if it has succeeded, but is not used by the tests.

The test test__error isn't run by default, but if the skip is removed, it will demonstrate docker logs being provided in the case of an error.

Supported platforms

We have tested these examples successfully on:

  • Linux

These platforms are not supported (the examples rely on being able to access the IP of the running container from the host):

  • docker-machine
  • Docker beta for Mac or Windows

At this time (July 2016) the docker beta does not support accessing containers by IP from the host.

Running tests

  1. Build the example image:
pushd service
docker build -t service .
popd
  1. Install dependencies:
(some_virtual_env) pip install -r test_requirements.txt
  1. Run the tests:
(some_virtual_env) py.test test_screencast.py

To demonstrate log output on test failure, remove pytest.mark.skip from test__error.

Thanks!

  • Thanks to @BlueMonday for the code that checks if a pull request as failed, and for help with this problem in general!
  • Thanks also to the test tools team (@BlueMonday, @MeabhG, Jordan Taekema) at @Demonware.

pytest-dockerpy's People

Contributors

bobcatfish avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

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.