From 521f0802985162f3a5d2d894cbac44ee26cc64ad Mon Sep 17 00:00:00 2001 From: Athroniaeth Date: Sat, 3 Feb 2024 21:59:06 +0100 Subject: [PATCH] Patch, if 'lock.lock(function, arguments)' is use with List for argument, test always passed after lock, throw raise and indicates that the arguments should be surrounded by a tuple like this 'lock.lock(function, (arguments,))'. --- src/pytest_lock/fixtures/lock.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/pytest_lock/fixtures/lock.py b/src/pytest_lock/fixtures/lock.py index e1ee2c4..ab6c06d 100644 --- a/src/pytest_lock/fixtures/lock.py +++ b/src/pytest_lock/fixtures/lock.py @@ -9,6 +9,7 @@ from pytest_lock.fixtures.base import FixtureBase from pytest_lock.models.cache.lock import Lock +from pytest_lock.models.exceptions import LockException from pytest_lock.parser_file.builder import ParserFileBuilder if sys.version_info >= (3, 12): @@ -46,6 +47,10 @@ def lock(self, function: Callable, arguments: Tuple[Any, ...], extension: Option # Hides the execution of the error; the error will be visible in the test file. __tracebackhide__ = True + if not isinstance(arguments, tuple): + # Todo : Add test for invalid arguments + raise LockException("Arguments must be in a tuple\n'lock.lock(function, arguments)' -> 'lock.lock(function, (arguments,))'") + self.change_parser(extension) if self.config.ask_clean: