From 79c00b3b3c005d089915f318bae1611077a6704a Mon Sep 17 00:00:00 2001 From: Jussi Vatjus-Anttila Date: Sat, 23 Oct 2021 10:07:26 +0300 Subject: [PATCH] lockable_resource fixture yields now Allocation object (#22) --- example/test_example.py | 2 +- pytest_lockable/plugin.py | 4 ++-- setup.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/example/test_example.py b/example/test_example.py index 20789a8..3d8b38c 100644 --- a/example/test_example.py +++ b/example/test_example.py @@ -18,5 +18,5 @@ def test_example2(lockable_resource, lockable): """ Simple test """ print(f'Testing with resource: {lockable_resource}') with lockable.auto_lock({}) as allocation: - print(f'Testing with resource#2: {allocation.resource_info}') + print(f'Testing with resource#2: {allocation}') sleep(1) diff --git a/pytest_lockable/plugin.py b/pytest_lockable/plugin.py index 5da911a..03b3f45 100644 --- a/pytest_lockable/plugin.py +++ b/pytest_lockable/plugin.py @@ -42,9 +42,9 @@ def lockable_resource(pytestconfig, lockable): # pylint: disable=redefined-oute pytest fixture that lock suitable resource and yield it .. code-block:: python def test_foo(lockable_resource): - print(f'Testing with resource: {lockable_resource}') + print(f'Testing with resource: {lockable_resource.resource_info}') """ requirements = pytestconfig.getoption('allocation_requirements') timeout_s = pytestconfig.getoption('allocation_timeout') with lockable.auto_lock(requirements, timeout_s) as allocation: - yield allocation.resource_info + yield allocation diff --git a/setup.py b/setup.py index 383820d..9bd9377 100644 --- a/setup.py +++ b/setup.py @@ -52,7 +52,7 @@ python_requires='>=3.7, <4', install_requires=[ 'pytest', - 'lockable==0.6.0' + 'lockable==0.7.0' ], extras_require={ # Optional 'dev': ['nose', 'coveralls', 'pylint', 'coverage'],