pytest-lockable
pytest plugin for lockable resources.
Replacement for Jenkins lockable -plugin.
Locking is implemented using <resource.id>.lock files.
Resources are described in json file as array of objects. Each object has some mandatory fields but can contains any other as well. Required fields are: id, online, hostname-
Example resources.json
[
{
"id": "1234",
"online": true,
"hostname": "localhost"
}
]
id should be unique for each resources. online describes if resource are available for allocator. Set this false if you don't want to allocate resource. hostname is used to select suitable resource by running host.
installation
Requires: python 3.7<
pip install pytest-lockable
conftest.py:
pytest_plugins = ("lockable.plugin",)
Usage
Custom options:
--allocation_hostname=<hostname>, default=<os-hostname> Allocation host
--allocation_requirements=<requirements> Resource requirements to be allocate
--allocation_timeout=<timeout>, default=10 Allocation timeout in seconds
--allocation_resource_list_file=<filename>, default=resources.json
Available resorces list
--allocation_lock_folder=<folder>, default=<os-tmp-path> allocation lockfiles folder
<requirements> can be json-string or key-value pairs. requirements have to match available resources to make allocation possible. Key-value pairs example: key=value&key2=value2
Example:
See example test. Usage:
cd example
pytest --allocation_hostname localhost -s --allocation_lock_folder . .
Metadata
Release files for pytest-lockable 0.2.2
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-lockable-0.2.2.tar.gz | 13.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pytest_lockable-0.2.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 19.2 kB
Release files / pytest-lockable-0.2.2.tar.gz
| Download URL | pytest-lockable-0.2.2.tar.gz |
|---|---|
| Size | 13.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
51774ecb1e49593b1ce13a89c2c5caa7f257875c77b258db3ce44613e4ee0f83
|
|
BLAKE2b-256 checksum How to use checksums |
cc4847557094069f6758e21f0551da51e3e22145b90df344d37e5f2a6a0bd20b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.7.8
|
Release files / pytest_lockable-0.2.2-py3-none-any.whl
| Download URL | pytest_lockable-0.2.2-py3-none-any.whl |
|---|---|
| Size | 5.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9965f8490a08dd435c83c659be0a7f3990ae9684eb34a2fd5434b2d0ab497c13
|
|
BLAKE2b-256 checksum How to use checksums |
ff80373185ab94c51f5e55e70322e1f58d8aaa14e8099844c96a47dd30f47bee
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.7.8
|