Skip to main content

lockable resource plugin for pytest

Project description


CircleCI PyPI version Coverage Status

pytest plugin for lockable resources.

Replacement for Jenkins lockable -plugin. Locking is implemented using <>.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.


Requires: python 3.7<

pip install pytest-lockable

pytest_plugins = ("lockable.plugin",)


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


See example test. Usage:

cd example
pytest --allocation_hostname localhost -s --allocation_lock_folder .  .

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

pytest-lockable-0.2.1.tar.gz (13.8 kB view hashes)

Uploaded Source

Built Distribution

pytest_lockable-0.2.1-py3-none-any.whl (5.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page