Skip to main content

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",
    "os": "Android"
  }
]

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.

Usage:

pytest --allocation_hostname localhost -s --allocation_requirements os=Android my_test

installation

Requires: python 3.7<

pip install pytest-lockable

conftest.py:

pytest_plugins = ("lockable.plugin",)

integrations

pytest-lockable integrates pytest-metadata - when resource is reserved and pytest-metadata plugin are in use metadata will be generated from resource json with resource_ -prefixes. e.g. resource_id=<id>. Same dictionary are also recorded to testsuite property using record_testsuite_property -method.

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

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.3.0.tar.gz (14.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pytest_lockable-0.3.0-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pytest-lockable-0.3.0.tar.gz
  • Upload date:
  • Size: 14.2 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for pytest-lockable-0.3.0.tar.gz
Algorithm Hash digest
SHA256 289c37093ac8bf8909c4009f666954e493c27a5a8569a7d83fe26f8e48f64379
MD5 8b34a869ffcb69e4fe59e4ba503fc7e1
BLAKE2b-256 7bf3d27704701cfac5ce4a56525eccf1ad6895c4fd35bc82cb5e6af5de09487b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pytest_lockable-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 5.7 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for pytest_lockable-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 795d1e02048766bbb4a13e5af406d1f42b83b6d82bb6fde507cf57095c6a0a53
MD5 ea0eaba61e92276c180bee0dcdc77050
BLAKE2b-256 f2423ff863afc873139d8ce10df71885a257d80ec1a47dc0779378697a9a4bbd

See more details on using hashes here.

Release history Release notifications | RSS feed

0.11.0

2 files

0.10.0

2 files

0.9.3

2 files

0.9.2

2 files

0.9.1

2 files

0.9.0

2 files

0.8.3

2 files

0.8.2

2 files

0.8.1

2 files

0.8.0

2 files

0.7.5

2 files

0.7.4

2 files

0.7.3

2 files

0.7.2

2 files

0.7.1

2 files

0.7.0

2 files

0.6.1

2 files

0.6.0

2 files

0.5.0

2 files

0.4.0

2 files

This release

0.3.0 This release

2 files

0.2.3

2 files

0.2.2

2 files

0.2.1

2 files

0.2.0

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page