-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: use the test node location when determining snapshot class name #197
Conversation
Codecov Report
@@ Coverage Diff @@
## master #197 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 16 16
Lines 867 868 +1
=========================================
+ Hits 867 868 +1 |
@@ -16,8 +17,8 @@ def __init__(self, node: Any): | |||
|
|||
@property | |||
def classname(self) -> Optional[str]: | |||
classes = self._node.obj.__qualname__.split(".")[:-1] | |||
return ".".join(classes) if classes else None | |||
_, __, qualname = self._node.location |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where are you seeing documentation for "location"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah found it. This is "Item" not "Node": https://docs.pytest.org/en/latest/_modules/_pytest/nodes.html#Item, although I don't see where the 3rd element of the tuple is defined
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's Function
which inherits from Item
and for our use PyobjMixin
https://docs.pytest.org/en/latest/_modules/_pytest/python.html#Function
With the location
property from Item
using the reportinfo
method overwritten in PyobjMixin
## [0.3.12](v0.3.11...v0.3.12) (2020-04-19) ### Bug Fixes * use the test node location when determining snapshot class name ([#197](#197)) ([1010c94](1010c94))
🎉 This PR is included in version 0.3.12 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Description
Use the pytest node location to parse the full class name path
Related Issues
Checklist
Additional Comments
No additional comments.