Skip to main content

lockable resource plugin for pytest

Project description

pytest-lockable

CircleCI PyPI version Coverage Status

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 .  .

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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file pytest-lockable-0.2.1.tar.gz.

File metadata

  • Download URL: pytest-lockable-0.2.1.tar.gz
  • Upload date:
  • Size: 13.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.7

File hashes

Hashes for pytest-lockable-0.2.1.tar.gz
Algorithm Hash digest
SHA256 cf213c3c05490658dfa4719a57408c4b83a45778935d62f831e089e98dfd0523
MD5 4fad1dd5c175c98c0bf8cca7e0753262
BLAKE2b-256 064b0f2a61a1266ac24968aee8f045cadc4b4220f41f90a24db75352f2fb9b1d

See more details on using hashes here.

File details

Details for the file pytest_lockable-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: pytest_lockable-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.7

File hashes

Hashes for pytest_lockable-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5ad7a9af51f8f980c4dc75a5eb66ee3759fd4405824746cfbc6d7a94a8e72daf
MD5 7d1d69a65c04ffeb05e307c6ea0e297d
BLAKE2b-256 31544b54ef62e3a67e2bb49b8c779aff6472ef17de7b7a67dc3c6f4dca487328

See more details on using hashes here.

Supported by

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