Skip to content
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

feat: remove unused snapshots in snapshot file #11

Merged
merged 19 commits into from
Dec 4, 2019
Merged

Conversation

iamogbz
Copy link
Collaborator

@iamogbz iamogbz commented Nov 30, 2019

DevQA

Comments

@iamogbz iamogbz requested a review from noahnu December 2, 2019 21:37
setup.py Show resolved Hide resolved
src/syrupy/io.py Outdated Show resolved Hide resolved
@@ -25,24 +25,34 @@ def __init__(
self._serializer_class = serializer_class
self._test_location = test_location
self._executions = 0
self._session = session

from .session import SnapshotSession
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to refactor so we don't have to import within the method?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think so but the refactor is quite extensive and not valuable imo since the only usecase here was for the type hinting.


def _in_snapshot_dir(self, path: str) -> bool:
parts = path.split(os.path.sep)
return SNAPSHOT_DIRNAME in parts

@lru_cache(maxsize=32)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did you notice a performance issue?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, but I didn't see any reason why it should be executed every single time an assertion was registered. Might be a bit premature...

src/syrupy/plugins/image/io.py Show resolved Hide resolved
src/syrupy/plugins/image/io.py Outdated Show resolved Hide resolved
noahnu
noahnu previously approved these changes Dec 4, 2019
Copy link
Collaborator

@noahnu noahnu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CR LGTM

src/syrupy/session.py Outdated Show resolved Hide resolved
@noahnu
Copy link
Collaborator

noahnu commented Dec 4, 2019

When testing this locally I noticed unused snapshots -- so it works but we should still remove these snapshots before merging this.

I also have .githooks.ini modified locally for some reason after running the linter.

@iamogbz iamogbz requested a review from noahnu December 4, 2019 14:51
for some reason it keeps adding it
@iamogbz iamogbz merged commit a5c46b1 into master Dec 4, 2019
@iamogbz iamogbz deleted the unused-snapshots branch December 4, 2019 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants