Skip to content

Commit

Permalink
Slightly simplify and clarify instrumented code
Browse files Browse the repository at this point in the history
  • Loading branch information
EliahKagan committed Jan 2, 2025
1 parent 0300de9 commit a0f8425
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions test/test_git.py
Original file line number Diff line number Diff line change
Expand Up @@ -763,16 +763,13 @@ def test_handle_process_output(self):
from git.cmd import handle_process_output, safer_popen

expected_line_count = 5002
line_counts = [None, 0, 0]
lines = [None, [], []]
actual_lines = [None, [], []]

def stdout_handler(line):
line_counts[1] += 1
lines[1].append(line)
actual_lines[1].append(line)

def stderr_handler(line):
line_counts[2] += 1
lines[2].append(line)
actual_lines[2].append(line)

cmdline = [
sys.executable,
Expand All @@ -789,8 +786,8 @@ def stderr_handler(line):

handle_process_output(proc, stdout_handler, stderr_handler, finalize_process)

self.assertEqual(line_counts[1], expected_line_count, repr(lines[1]))
self.assertEqual(line_counts[2], expected_line_count, repr(lines[2]))
self.assertEqual(len(actual_lines[1]), expected_line_count, repr(actual_lines[1]))
self.assertEqual(len(actual_lines[2]), expected_line_count, repr(actual_lines[2]))

def test_execute_kwargs_set_agrees_with_method(self):
parameter_names = inspect.signature(cmd.Git.execute).parameters.keys()
Expand Down

0 comments on commit a0f8425

Please sign in to comment.