fix(snapshot): Support args with skip_snapshot_verify marker#15
fix(snapshot): Support args with skip_snapshot_verify marker#15gregfurman wants to merge 1 commit intomainfrom
Conversation
9f9e4be to
59920c0
Compare
There was a problem hiding this comment.
Question: should we actually accept the behavior, or fail when there are args? The signature of SkipSnapshotVerifyMarker is pretty clear, it only accepts keyword-only argument:
class SkipSnapshotVerifyMarker:
def __call__(
self,
*,
paths: "Optional[List[str]]" = None,
condition: "Optional[Callable[[...], bool]]" = None,
): ...See https://thepythoncodingbook.com/2022/12/11/positional-only-and-keyword-only-arguments-in-python/ and https://peps.python.org/pep-3102/
This PR goes a bit against that. I'd maybe suggest that we raise an exception if we pass an positional argument to the function, or maybe at least log a warning message as a first iteration to then raise an exception in a second one.
If we were to challenge this and change the behavior to accept positional arguments, we should also change the signature of the marker then.
Pretty cool tricks to extract the args though 👍
|
Hey @bentsku! Can I be unassigned? 👀 |
|
@gregfurman sure thing! Should I close the PR? I think one thing we could do in relation to the original issue is raised an exception if there are any positional argument being passed that aren't keyword arguments, WDYT? |
Motivation
Currently, the
skip_snapshot_verifymarker only acceptspathsas**kwargs-- where passing in positional*argsend up being skipped and not used.Changes
argsare defined, unpack them, and assign skip paths & conditions correctly.TODO