=============
pytest-consul is a pytest plugin meant for being able to do integration and
unit testing against [Hashicorp's Consul](https://www.consul.io/).
This plugin is heavily influenced by the design of
[DisposableConsul](https://github.com/EverythingMe/disposable-consul).
Install
-------
$ pip install pytest-consul
Usage
-----
When pytest-consul is installed, the fixtures available will ensure that an
actual local consul agent in bootstrap mode is running. The fixture object
contains a dictionary containing each of the exposed consul ports by name.
The `consul` fixture is session scoped. All tests using it will share catalog
and kv state.
def test_consul_thing(consul):
http_port = consul['http']
my_app.register_consul(('localhost', http_port))
my_app.do_something_that_writes_to_consul_kv()
resp = requests.get('http://localhost:{port}/v1/key/my-test-key'.format(
port=http_port))
actual_value = base64.b64decode(resp.json()[0]['Value'])
assert actual_value == 'my-expected-value'
The `consul_clean` fixture is function scoped. If you want a clean consul state
for a given test, this fixture will provide it.
Note
----
The consul agent takes a second or two to start up, even in bootstrap mode.
This makes these fixtures better for integration style tests, rather than unit
tests. Using the function scope `consul_clean` in particular is going to add
that additional latency to every single test which uses it. The flip side of
this is that using the session scope `consul` will not give you test isolation;
if your tests leave values in the kv store or catalog, it may affect any tests
that run after them.
Options
-------
pytest-consul adds the option `--consul-binary` to py.test, allowing you to
utilize a specific consul binary. By default, it will pick the first `consul`
available in the PATH.
Metadata
Release files for pytest-consul 0.2.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 | Provenance | Actions |
|---|---|---|---|---|
| pytest-consul-0.2.0.tar.gz | 5.1 kB | Without provenance | Details for pytest-consul-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pytest_consul-0.2.0-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for pytest_consul-0.2.0-py2.py3-none-any.whl |
Total release size: 11.8 kB
Release files / pytest-consul-0.2.0.tar.gz
| Download URL | pytest-consul-0.2.0.tar.gz |
|---|---|
| Size | 5.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9990cff16f624b155b0a54ccf10dc16885d793365af020a5e6844a987914d3dd
|
|
BLAKE2b-256 checksum How to use checksums |
f8be1cded3f5fd26962899583b1bca426f14ad1dfee7d79ea5e00d7dcfa94b14
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/2.7.14
|
Release files / pytest_consul-0.2.0-py2.py3-none-any.whl
| Download URL | pytest_consul-0.2.0-py2.py3-none-any.whl |
|---|---|
| Size | 6.7 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
a521a1010de3fca4b70f4e02cc9519041763ab430650fbccf730f65a822be180
|
|
BLAKE2b-256 checksum How to use checksums |
b28173d35eb6aa0eadc6154304d75c968eff439063b9580e1421582d6e805da8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/2.7.14
|
Security for pytest-consul 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.