{"id":19378833,"url":"https://github.com/linbit/lbpytest","last_synced_at":"2025-07-23T16:32:28.875Z","repository":{"id":62575321,"uuid":"402049471","full_name":"LINBIT/lbpytest","owner":"LINBIT","description":"Reusable components from our test environment","archived":false,"fork":false,"pushed_at":"2025-02-06T15:26:53.000Z","size":41,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-02-06T16:30:55.006Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LINBIT.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-09-01T12:17:24.000Z","updated_at":"2025-02-06T15:25:33.000Z","dependencies_parsed_at":"2025-01-07T05:40:53.043Z","dependency_job_id":"33534c15-740c-40df-bd56-bfe51dc2db41","html_url":"https://github.com/LINBIT/lbpytest","commit_stats":{"total_commits":18,"total_committers":2,"mean_commits":9.0,"dds":"0.38888888888888884","last_synced_commit":"4c1d7cba7255430b1195dc5b2449ba1134e04cf9"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LINBIT%2Flbpytest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LINBIT%2Flbpytest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LINBIT%2Flbpytest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LINBIT%2Flbpytest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LINBIT","download_url":"https://codeload.github.com/LINBIT/lbpytest/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240511440,"owners_count":19813263,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-10T09:07:32.003Z","updated_at":"2025-02-24T16:24:36.031Z","avatar_url":"https://github.com/LINBIT.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# lbpytest\n\n[![PyPI](https://img.shields.io/pypi/v/lbpytest)](https://pypi.org/project/lbpytest/)\n\nUtilities for Python-driven integration tests at LINBIT.\n\n## Installation\n\n```bash\npip install lbpytest\n```\n\n## Usage\n\n### [ControlMaster](./src/lbpytest/controlmaster.py)\n\n```python\nfrom lbpytest.controlmaster import SSH\nfrom io import StringIO\nimport subprocess\nimport sys\n\ntry:\n    ssh = SSH(\"myhost.example.org\")\nexcept subprocess.CalledProcessError as e:\n    print(e.stderr.decode('utf-8'), file=sys.stderr)\n    raise e\n\n# Run command using the hosts stdin/stdout/stderr\nssh.run(\"echo 'Hello, World!'\")\n\n# Save command output\noutput = StringIO()\nssh.run(\"echo 'Hello, World!'\", stdout=output)\nprint(output.getvalue()) # prints Hello, World!\n\nssh.close()\n```\n\n### [Logscan](./src/lbpytest/logscan.py)\n\nSee [`test_logscan.py`](./src/lbpytest/test_logscan.py) and\n[`test_logscan_ssh.py`](./src/lbpytest/test_logscan_ssh.py).\n\n## Testing\n\nThe unit tests for this project can be run using `pytest`:\n\n```\n$ pytest src/lbpytest\n```\n\nNote that for the `ControlMaster` tests, a `--host` option is required. This should specify the IP address or hostname\nof an SSH server to use for the test.\n\n## Type Checking\n\nThis library uses [type annotations](https://docs.python.org/3/library/typing.html).\nThe [mypy](http://mypy-lang.org/) tool can be used to verify these annotations:\n\n```\n$ mypy src/lbpytest\n```\n\n## License\n\n[Apache License 2.0](https://choosealicense.com/licenses/apache-2.0/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinbit%2Flbpytest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flinbit%2Flbpytest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinbit%2Flbpytest/lists"}