Utilities for Python-driven integration tests at LINBIT
Project description
lbpytest
Utilities for Python-driven integration tests at LINBIT.
Installation
pip install lbpytest
Usage
ControlMaster
from lbpytest.controlmaster import SSH
from io import StringIO
import subprocess
import sys
try:
ssh = SSH("myhost.example.org")
except subprocess.CalledProcessError as e:
print(e.stderr.decode('utf-8'), file=sys.stderr)
raise e
# Run command using the hosts stdin/stdout/stderr
ssh.run("echo 'Hello, World!'")
# Save command output
output = StringIO()
ssh.run("echo 'Hello, World!'", stdout=output)
print(output.getvalue()) # prints Hello, World!
ssh.close()
Logscan
See test_logscan.py and
test_logscan_ssh.py.
Testing
The unit tests for this project can be run using pytest:
$ pytest src/lbpytest
Note that for the ControlMaster tests, a --host option is required. This should specify the IP address or hostname
of an SSH server to use for the test.
Type Checking
This library uses type annotations. The mypy tool can be used to verify these annotations:
$ mypy src/lbpytest
License
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lbpytest-0.4.0.tar.gz.
File metadata
- Download URL: lbpytest-0.4.0.tar.gz
- Upload date:
- Size: 15.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.21
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a10836a32b6e30d4cc9df06254e0e1630a7079a56ed972f23dbedc9a22a70aa3
|
|
| MD5 |
4396c2514eced4a0dcab7b568b2e11cd
|
|
| BLAKE2b-256 |
f6e4f4679c4d386365d25420011f034c62cd7bdc718083ed7496b6616f426457
|
File details
Details for the file lbpytest-0.4.0-py3-none-any.whl.
File metadata
- Download URL: lbpytest-0.4.0-py3-none-any.whl
- Upload date:
- Size: 17.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.21
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
978c8af17d240b228695a8f114169a475f7e2fde0e57dd43ca82b8b17db8371b
|
|
| MD5 |
4e94c54bbb5f05b179962e18d05eb258
|
|
| BLAKE2b-256 |
e34c85f468e1cfa01d97a6b0a46bd2473dae28857a6721cc17348ba5a6bce774
|