Skip to main content
https://travis-ci.org/marc-lopez/process-wrapper.svg?branch=v0.3.x https://coveralls.io/repos/marc-lopez/process-wrapper/badge.svg?branch=v0.3.x

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

Thanks to

jung rhew for providing the basis of process teardown code that I used

Metadata

Release files for process-wrapper 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for process-wrapper 0.3.0
File Interpreter ABI Platform
process_wrapper-0.3.0-py2.py3-none-any.whl Python 2, Python 3 none any Details

Release files / process_wrapper-0.3.0-py2.py3-none-any.whl

Download URL process_wrapper-0.3.0-py2.py3-none-any.whl
Size 6.6 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
e6bc8be54d23f297af1625f7540168a4b3b26332e1ba65a2ce28e1267df40cfc
BLAKE2b-256 checksum
How to use checksums
b3272df972f3c089948961268b6f61930c8b43b64ca4f1f01209ce11d0db8b0d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.3.0 This release

1 release file

0.2.2

1 release file

0.2.1

0.2.0

1 release file

0.1.2

1 release file

0.1.1

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page