Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nxht/pytest-bg-process
Pytest plugin for background process
https://github.com/nxht/pytest-bg-process
Last synced: 23 days ago
JSON representation
Pytest plugin for background process
- Host: GitHub
- URL: https://github.com/nxht/pytest-bg-process
- Owner: nxht
- License: mit
- Created: 2021-05-28T19:57:28.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2022-01-24T18:47:42.000Z (almost 3 years ago)
- Last Synced: 2024-04-29T02:21:35.351Z (6 months ago)
- Language: Python
- Size: 7.81 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# pytest-bg-process
Pytest plugin to initialize background process.
The process will start once before all the tests using [subprocess.Popen](https://docs.python.org/3/library/subprocess.html#subprocess.Popen) and will be killed once all the tests finished.
## Installation
```
pip install pytest-bg-process
```## Configuration
From [pytest configuration](https://docs.pytest.org/en/latest/reference/customize.html#configuration-file-formats):
- background-cmd:
- Path to command to run at background
- Default: None
- background-cmd-env:
- Environmental variable to path to command to run at background.
- Has higher priority than background-cmd.
- Default: None
- background-pid:
- Path to save PID data of the background process.
- Default: background.pid
- background-log:
- Path to save log data of the background process.
- Default: background.log## Example
### Using background-cmd
```ini
[pytest]
background-cmd=redis-server
background-pid=redis.pid
background-log=redis.log
```### Using background-cmd-env
```ini
[pytest]
background-cmd-env=REDIS_CMD
background-pid=redis.pid
background-log=redis.log
```then
```bash
REDIS_CMD=redis-server && pytest
```