Skip to main content

Utilities for Python-driven integration tests at LINBIT

Project description

lbpytest

PyPI

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

Apache License 2.0

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

lbpytest-0.5.1.tar.gz (15.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lbpytest-0.5.1-py3-none-any.whl (17.4 kB view details)

Uploaded Python 3

File details

Details for the file lbpytest-0.5.1.tar.gz.

File metadata

  • Download URL: lbpytest-0.5.1.tar.gz
  • Upload date:
  • Size: 15.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for lbpytest-0.5.1.tar.gz
Algorithm Hash digest
SHA256 21e9f8e7ebc8c69f2c995251d9175848509d406b9f75eba69213e8a997028bcb
MD5 8221bda012851a9e67a6c11b2b780b84
BLAKE2b-256 72717df01d0b1c0239f94308906948d3e0c07d395f957980e8dcd03e3292bd8e

See more details on using hashes here.

File details

Details for the file lbpytest-0.5.1-py3-none-any.whl.

File metadata

  • Download URL: lbpytest-0.5.1-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.13.7

File hashes

Hashes for lbpytest-0.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 31eba4aa75c6ec037005b3679a3bfa2f0e6b1e115c5c55ef076c9f1029a69236
MD5 b0d95b5a9b9e7c3d692c33ecf35334dd
BLAKE2b-256 03c77f1f60f006f3ceb86cfa61350085af3fce1e4fae1c4536d38c31918cf4c7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page