A pytest plugin that provides a running Argus API server for tests.
This pytest plugin was generated with Cookiecutter along with @hackebrot’s cookiecutter-pytest-plugin template.
Features
Fixtures that will provide tests with a running Argus API server (using Docker Compose)
Requirements
Installation
You can install “pytest-argus-server” via pip from PyPI:
$ pip install pytest-argus-server
Usage
Installing this package will automatically make it available in pytest.
Extra pytest command line arguments
By default, this plugin will run the latest available Argus server Docker image. The actually deployed version can be controlled by adding the --argus-version command line option to pytest:
pytest --argus-version=2.7.0 tests/
Provided fixtures
The main fixtures provided by this plugin are the session-scoped argus_api_url and argus_source_system_token.
argus_api_url
When used by a test, this will ensure an Argus server is running and ready to take requests. It returns the base URL of the running API:
def test_url_should_be_as_expected(argus_api_url):
assert argus_api_url == "http://127.0.0.1:8000/api/v2/"
argus_source_system_token
This token will create a test source system and return a valid API token for accessing the API as this test source.
def test_fetch_incidents(argus_api_url, argus_source_system_token):
assert requests.get(
f"{argus_api_url}/incidents/",
headers={"Authorization": f"Token {argus_source_system_token}"}
).status_code == 200
Bugs
The port number of the launched API server is hard-coded to 8000.
Contributing
Contributions are very welcome. Tests can be run with tox, please ensure the coverage at least stays the same before you submit a pull request.
All code needs to be formatted and linted by ruff. The pre-commit tool is used to enforce code styles at commit-time. To enable the pre-commit hooks in your repository run:
$ pre-commit install
License
Distributed under the terms of the Apache Software License 2.0 license, “pytest-argus-server” is free and open source software
Issues
If you encounter any problems, please file an issue along with a detailed description.
Metadata
Release files for pytest-argus-server 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pytest_argus_server-0.4.0.tar.gz | 21.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pytest_argus_server-0.4.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 31.9 kB
Release files / pytest_argus_server-0.4.0.tar.gz
| Download URL | pytest_argus_server-0.4.0.tar.gz |
|---|---|
| Size | 21.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2f2d7c9c1d8a2abd0856fb8a9c604f9d9da4f0a39f021aaf3fbf8db652bd4fcd
|
|
BLAKE2b-256 checksum How to use checksums |
9c710216ba0745e0d72e97800c60fbd7f30f685c00d57416c43cb0759a28017b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"NixOS","version":"26.05","id":"yarara","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / pytest_argus_server-0.4.0-py3-none-any.whl
| Download URL | pytest_argus_server-0.4.0-py3-none-any.whl |
|---|---|
| Size | 10.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
56b964fd6388d7928607872b777e70d0cbcae75daebcc66625660dabc9ae5e95
|
|
BLAKE2b-256 checksum How to use checksums |
47df37b85b7a3a86ab9a843c522d7fc00d2fdec7d6358c703783695ad7b7e48c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"NixOS","version":"26.05","id":"yarara","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|