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

Fix issue with TypeError for empty file diffs #271

Merged
merged 1 commit into from
Jan 28, 2023

Conversation

yanekk
Copy link
Collaborator

@yanekk yanekk commented Jan 28, 2023

Hi!

Here's the fix for the problem I stumbled upon when I was doing some experiments on running mutation tests based on git patch. The problem was whatthepatch library returns None instead of empty list as a value for diff.changes if file has no changes (new empty file, renamed empty file, removed empty file - tested on MacOS and Windows 10), which made mutmut to crash because of the set comprehension requirement in __init__.py. I tested it on current version of whatthepatch (1.0.3) and one from requirements (0.0.6), but for both versions the behaviour was the same.

Unfortunately, not only it didn't parse the patch, but also crash mutmut. Therefore, I thought it would be good idea to fix it, since without it it would require for my use case to generate list of changed lines externally as a coverage report and pass it with the --use-coverage parameter.

As before, I added a regression unit test suite to make sure it won't happen again.

@boxed boxed merged commit f8d5dd8 into boxed:master Jan 28, 2023
@boxed
Copy link
Owner

boxed commented Jan 28, 2023

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants