From: Andrey Rakhmatullin <wrar@wrar.name>
Date: Mon, 27 Oct 2025 20:15:57 +0500
Subject: Better mocking of streams for TextTestResult.

---
 tests/test_command_check.py | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/tests/test_command_check.py b/tests/test_command_check.py
index 975f31d..4de37e0 100644
--- a/tests/test_command_check.py
+++ b/tests/test_command_check.py
@@ -1,6 +1,6 @@
 import sys
 from io import StringIO
-from unittest.mock import Mock, PropertyMock, call, patch
+from unittest.mock import MagicMock, Mock, PropertyMock, call, patch
 
 from scrapy.commands.check import Command, TextTestResult
 from tests.test_commands import TestCommandBase
@@ -103,7 +103,7 @@ class CheckSpider(scrapy.Spider):
     def test_printSummary_with_unsuccessful_test_result_without_errors_and_without_failures(
         self,
     ):
-        result = TextTestResult(Mock(), descriptions=False, verbosity=1)
+        result = TextTestResult(MagicMock(), descriptions=False, verbosity=1)
         start_time = 1.0
         stop_time = 2.0
         result.testsRun = 5
@@ -115,7 +115,7 @@ class CheckSpider(scrapy.Spider):
             mock_write.assert_has_calls([call("FAILED"), call("\n")])
 
     def test_printSummary_with_unsuccessful_test_result_with_only_failures(self):
-        result = TextTestResult(Mock(), descriptions=False, verbosity=1)
+        result = TextTestResult(MagicMock(), descriptions=False, verbosity=1)
         start_time = 1.0
         stop_time = 2.0
         result.testsRun = 5
@@ -126,7 +126,7 @@ class CheckSpider(scrapy.Spider):
             mock_write.assert_called_with(" (failures=1)")
 
     def test_printSummary_with_unsuccessful_test_result_with_only_errors(self):
-        result = TextTestResult(Mock(), descriptions=False, verbosity=1)
+        result = TextTestResult(MagicMock(), descriptions=False, verbosity=1)
         start_time = 1.0
         stop_time = 2.0
         result.testsRun = 5
@@ -139,7 +139,7 @@ class CheckSpider(scrapy.Spider):
     def test_printSummary_with_unsuccessful_test_result_with_both_failures_and_errors(
         self,
     ):
-        result = TextTestResult(Mock(), descriptions=False, verbosity=1)
+        result = TextTestResult(MagicMock(), descriptions=False, verbosity=1)
         start_time = 1.0
         stop_time = 2.0
         result.testsRun = 5
