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

Removed assumptions when mutant is killed #240

Closed
wants to merge 1 commit into from

Conversation

krystalgamer
Copy link

Commit 1ade5e5 added the assumptions that if a mutant was killed regardless of the test file changing it'd still be marked as killed.

Even though it might offer a performance boost, I don't think it's really worth it because mutmut becomes blind to any kind of refactor, either in the source code or the test code.

Caught me offguard and I think it might happen to other developers too.

@boxed
Copy link
Owner

boxed commented Nov 7, 2021

I don't agree with this change. It's not just a small performance boost, it's the difference between mutmut being something you can practically use, and not. If all kills are invalidated for each change to the test suite then you can't incrementally work towards your goal.

@krystalgamer
Copy link
Author

The reason for this PR was that a regression was introduced upon a refactor and mutmut didn't catch it, but the CI was able to do so.

I agree that a single change shouldn't invalidate the whole test suite, it'd be too much time consuming. Do you think it'd be worth to change the hash to work on a test file basis instead of suite?

@boxed
Copy link
Owner

boxed commented Nov 7, 2021

The problem with that is that it's a big redesign of mutmut :)

Mutmut doesn't know anything about what tests cover what code. That's partly by design as it makes mutmut usable for many different test systems. It's also partly because of limitations in the tooling for figuring this out, and limitations in test selection.

@DudeNr33
Copy link
Collaborator

DudeNr33 commented Nov 7, 2021

I don't know if I've fully understood the underlying problem.
Currently a change to the tests would trigger a rerun of the baseline tests:

mutmut/mutmut/__main__.py

Lines 459 to 464 in 5c31ba8

cached_time = cached_test_time()
if cached_time is not None and current_hash_of_tests == cached_hash_of_tests():
print('1. Using cached time for baseline tests, to run baseline again delete the cache file')
return cached_time
print('1. Running tests without mutations')

What was your situation? It sounds to me like the following since you say the CI was able to catch the regression:

  1. you started your mutation testing at a time where all tests were passing
  2. you stopped you mutation test run
  3. you modified the production code, but left the tests as they were
  4. you then continued your mutation test session, and mutmut did not notice? Instead, it probably marked every mutant as killed, as the tests were failing all the time?

In that case it might be a compromise to add an option to rerun the baseline tests first every time you resume your mutation testing session.

@boxed boxed deleted the branch boxed:master October 20, 2024 12:03
@boxed boxed closed this Oct 20, 2024
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.

3 participants