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.3.0.tar.gz (15.5 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.3.0-py3-none-any.whl (17.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: lbpytest-0.3.0.tar.gz
  • Upload date:
  • Size: 15.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for lbpytest-0.3.0.tar.gz
Algorithm Hash digest
SHA256 73ae9ca1c1c9d0f1bd5b175c23a12b0f37d54b0f16b3b707e395f9ce7e6cc97e
MD5 a6be72e8deee0fac573e3ae0c83c7b6c
BLAKE2b-256 10cb491dcedc23c4c37d279bc57dc9dfd73812285bb981c64dd87c8cf07f6620

See more details on using hashes here.

File details

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

File metadata

  • Download URL: lbpytest-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 17.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for lbpytest-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cc325a8e2508bcb13cf16d86473c5ae2b3c6f249c12dcc9d1e18c3b710024153
MD5 690d19a2efa5fd0755fce206d9761f6e
BLAKE2b-256 87b8b73b551d2feae3b95ae1be70b02c241b0eea98c499324276ac6f3b8a3b89

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