-
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
perf: only clear assertion _extension
when overridden
#172
Conversation
Codecov Report
@@ Coverage Diff @@
## master #172 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 16 16
Lines 859 864 +5
=====================================
+ Hits 859 864 +5 |
_extension
property when not overridden
) | ||
_executions: int = attr.ib(init=False, default=0) | ||
_execution_results: Dict[int, "AssertionResult"] = attr.ib(init=False, factory=dict) | ||
_post_assert_actions: List[Callable[..., None]] = attr.ib(init=False, factory=list) |
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.
Could use a deque
but that seems like premature optimisations
_extension
property when not overridden_extension
when overridden
@@ -51,5 +51,6 @@ def test_multiple_snapshot_extensions(snapshot): | |||
""" | |||
assert actual_svg == snapshot(extension_class=SVGImageSnapshotExtension) | |||
assert actual_svg == snapshot # uses initial extension class | |||
assert snapshot._extension is not None |
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.
This is testing internals. Is there a user facing test?
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's no user effect only that slight performance drawback of generating the extension instance on each assertion
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.
Bit concerned about coupling the internal implementation with the test cases, but am okay with this as a temporary measure until we have perf benchmarking
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 thought we weren't using that deprecated method?
## [0.3.8](v0.3.7...v0.3.8) (2020-04-03) ### Performance Improvements * only clear assertion `_extension` when overridden ([#172](#172)) ([82eae91](82eae91))
🎉 This PR is included in version 0.3.8 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Description
_extension
property cache is always clearedRelated Issues
N/A
Checklist
Additional Comments