aboutsummaryrefslogtreecommitdiffstats
path: root/tests/helpers.py (unfollow)
Commit message (Collapse)AuthorLines
2020-08-22Decorators: replace asyncio.Lock with a custom objectGravatar MarkKoz-4/+28
Concerns were raised over possible race conditions due `asyncio.Lock` internally awaiting coroutines. Does a mere `await` suspend the current coroutine, or does it have to actually await something asynchronous, like a future? Avoid answering that question by doing away with the awaits, which aren't necessary but are there as a consequence of using `asyncio.Lock`. Instead, add a custom `LockGuard` object to replace the previous locks.
2020-08-01Explicitly use kwarg with respect_role_hierarchyGravatar MarkKoz-5/+5
Clarify the significance of the argument being passed.
2020-08-01Decorators: fix type annotations for checksGravatar MarkKoz-4/+4
The annotation was previously changed on the basis of an incorrect return annotation PyCharm inferred for `check()`.
2020-07-31Reminders: use singular form for mutually exclusive namespaceGravatar MarkKoz-1/+1
The exception it raises reads better if the singular form of the word is used.
2020-07-31Reminders: show error to users if reminder is in useGravatar MarkKoz-3/+3
Silent failure is confusing to users. Showing an error message clears up why nothing happened with their command.
2020-07-31Send users an error message if command raises LockedResourceErrorGravatar MarkKoz-0/+3
2020-07-31Decorators: optionally raise an exception if resource is lockedGravatar MarkKoz-4/+35
The exception will facilitate user feedback for commands which use the decorator.
2020-07-31Decorators: add some trace loggingGravatar MarkKoz-0/+3
2020-07-31Decorators: wrap mutually_exclusive to use get_arg_valueGravatar MarkKoz-7/+20
Instead of taking a callable, this wrapper just takes a name or position to get the resource ID.
2020-07-31Decorators: remove redundant word in docstringGravatar MarkKoz-1/+1
2020-07-31Decorators: use type aliases from function moduleGravatar MarkKoz-4/+2
2020-07-31Decorators: remove default value for respect_role_hierarchyGravatar MarkKoz-3/+3
Explicit is better than implicit, and this default value wasn't much of a convenience.
2020-07-31Decorators: use new func utils in respect_role_hierarchyGravatar MarkKoz-30/+13
Replace the `_get_arg_value` call with `function.get_arg_value` cause the latter makes use of bound arguments, which are more accurate.
2020-07-31Add a function to get bound argsGravatar MarkKoz-4/+17
2020-07-31Add a function to wrap a decorator to use get_arg_valueGravatar MarkKoz-1/+28
2020-07-31Reminders: make operations mutually exclusiveGravatar MarkKoz-0/+7
This fixes race conditions between editing, deleting, and sending a reminder. If one operation is already happening, the others will be aborted.