Test the git settings Gremlins' environment gets
CI / tests (pull_request) Failing after 4m8s

This commit is contained in:
2026-11-20 23:38:39 +01:00
parent a430bca9f9
commit e3cc18f04e
+13
View File
@@ -14,6 +14,7 @@ import unittest
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
from mutate_changes.changed_lines import added_lines, by_folder, not_mutated, runs, tool_for
from mutate_changes.in_diff_tools import with_zero_diff_context
from mutate_changes.mutmut_tool import copy_files
from mutate_changes.mutmut_mutants import crash_in_mutmut, function_keys, mutant_globs, mutated_line, named, statuses
from failure import Failure
@@ -146,6 +147,18 @@ class ChangedLines(unittest.TestCase):
self.assertEqual((not_mutated(["a.py", "test_a.py"]), not_mutated(["a.py", "b.rb"]), not_mutated([])), (["Not mutated, as test files: test_a.py."], ["Not mutated, as no tool covers their language: b.rb."], []))
class InDiffTools(unittest.TestCase):
def test_zero_diff_context_is_added_after_the_settings_the_environment_holds(self):
setting = {"GIT_CONFIG_KEY_0": "safe.directory", "GIT_CONFIG_VALUE_0": "*"}
self.assertEqual(with_zero_diff_context({"HOME": "/h", "GIT_CONFIG_COUNT": "1", **setting}), {"HOME": "/h", "GIT_CONFIG_COUNT": "2", **setting, "GIT_CONFIG_KEY_1": "diff.context", "GIT_CONFIG_VALUE_1": "0"})
def test_zero_diff_context_is_the_first_setting_where_the_environment_holds_none_or_a_count_that_is_no_number(self):
first = {"GIT_CONFIG_COUNT": "1", "GIT_CONFIG_KEY_0": "diff.context", "GIT_CONFIG_VALUE_0": "0"}
for held in ({}, {"GIT_CONFIG_COUNT": "many"}, {"GIT_CONFIG_COUNT": ""}):
with self.subTest(held):
self.assertEqual(with_zero_diff_context(held), first)
class MutmutSetup(unittest.TestCase):
def test_the_config_mutates_the_sources_and_copies_each_entry_of_the_folder(self):
for existing in ("", "[mutmut]\nsource_paths = old.py\nalso_copy = old\n"):