Code Monkey home page Code Monkey logo

mirakuru's Introduction

mirakuru

Maybe you want to be able to start database only when you start your program, or maybe you need just to set up additional processes for your tests, this is where you should consider using mirakuru, to add superpowers to your program, or tests.

Latest PyPI version Number of PyPI downloads Wheel Status Egg Status License

Package status

Tests Coverage Status Requirements Status

About

As developers, we have to work on project that rely on multiple processes to run. We guard ourselves with tests. But sometimes it's not enough what one process sends, and the other receives. Sometimes there's need to actually exchange data between processes. Or write selenium tests. Or maybe write a program that takes care of starting databases or other required services itself.

If so, then mirakuru is what you need.

Mirakuru starts your required process, and wait for clear indication, that it's running. There are three basic executors with predefined conditions:

  • Executor - simply starts
  • OutputExecutor - awaits for specified output to be given by process
  • TCPExecutor - waits for ability to connect through tcp with process
  • HTTPExecutor - waits for successful HEAD request (and tcp before)
  • PidExecutor - waits for a specified file to exist
from mirakuru import HTTPExecutor
from httplib import HTTPConnection, OK


def test_it_works():
    executor = HTTPExecutor("./server", url="http://localhost:6543/")

    # start and wait for it to run
    executor.start()
    # should be running!
    conn = HTTPConnection("localhost", 6543)
    conn.request('GET', '/')
    assert conn.getresponse().status is OK
    executor.stop()

The server command in this case is just a bash script that sleeps for some time and then launches the builtin SimpleHTTPServer on port 6543.

Author

The project was first developed by Mateusz Lenik as summon_process. Later forked, renamed to mirakuru and tended to by The A Room @ Clearcode.

License

mirakuru is licensed under LGPL license, version 3.

Contributing and reporting bugs

Source code is available at: ClearcodeHQ/mirakuru. Issue tracker is located at GitHub Issues. Projects PyPi page.

When contributing, don't forget to add your name to AUTHORS.rst file.

mirakuru's People

Contributors

fizyk avatar tomislater avatar mlen avatar mruwnik avatar mekto avatar

Watchers

James Cloos 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.