This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

Context manager for background command-line programs

Project Description

Process Wrapper is a simple module that executes a command-line style program via a context manager. This is useful if you want your script to do something that relies on a background process.

This module is conceived because of a need to automate the setup and teardown of the Django server when running Robotframework tests. Sample usage would look like this:

#!/usr/bin/env python

import robot
from processwrapper import run_process

with run_process('python manage.py runserver'):
    robot.run('blackbox_test.robot')

Right now, the process being run is forcefully terminated with a SIGKILL or equivalent signal on context exit. Caution is advised.

To install

Run in command line:

pip install process-wrapper

Dependencies

psutil

Tested Capabilities

  • Kills parent and child processes on exit
  • Handles in-context exceptions: It still kills the called process and its children
  • Processes are properly cleaned up when in-context exceptions occur
  • Process wrapper will do nothing if it encounters a Process Not Found exception for the parent process and raise all others
  • Tested to work in win32 and linux2 platforms

Test Command

Command used to test the module. Includes line and branch coverage:

py.test processwrapper/tests --cov processwrapper --cov-report term-missing --pep8
Release History

Release History

This version
History Node

0.3.0

History Node

0.2.2

History Node

0.2.1

History Node

0.2.0

History Node

0.1.2

History Node

0.1.1

History Node

0.1.0

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
process_wrapper-0.3.0-py2.py3-none-any.whl (6.6 kB) Copy SHA256 Checksum SHA256 py2.py3 Wheel Sep 8, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting