Skip to content

Commit

Permalink
Patch, if 'lock.lock(function, arguments)' is use with List for argum…
Browse files Browse the repository at this point in the history
…ent, test always passed after lock, throw raise and indicates that the arguments should be surrounded by a tuple like this 'lock.lock(function, (arguments,))'.
  • Loading branch information
Athroniaeth committed Feb 3, 2024
1 parent ac49c51 commit 521f080
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/pytest_lock/fixtures/lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 521f080

Please sign in to comment.