Open James-Ansley opened 2 months ago
Looks good! Usually I would invite you to the weekly ensemble, but it's not NZ timezone friendly unfortunately. Anyway, know that you're always welcome there - https://github.com/approvals/ApprovalTests.Python/blob/main/docs/Contribute.md.
A recent release included support for alternative (i.e. non-"test") test prefixes.
Pytest, also uses a custom
__test__
dunder when discovering tests: python.py#L349. I.e. any function with the attribute__test__ = True
is considered a test regardless of its prefix. Currently, this library does not support this dunder.Would it be possible to support the
__test__
dunder in the recently addedis_pytest_test
method?I am happy to work on this unless someone else sees a quick fix.
Suggested Fix
An additional test in the StackFrameNamer class for the
__test__
dunder could be something like the following:Here, the function name is looked up in the frame globals, and if found, it checks for the
__test__
dunder. I would need to refresh my memory on Python'sFrameInfo
to check whether this is the best way of doing this.