33import unittest
44import subprocess
55import re
6+ from traceback import TIMESTAMP_AFTER_EXC_MSG_RE_GROUP
67
7- from test .support import script_helper
8+ from test .support import force_not_colorized , script_helper
89from test .support .os_helper import TESTFN , unlink
910
1011
@@ -209,6 +210,7 @@ def strip(data):
209210 script_file .write (self .script_strip_test )
210211 self .addCleanup (unlink , self .script_strip_path )
211212
213+ @force_not_colorized
212214 def test_strip_exc_timestamps_function (self ):
213215 """Test the strip_exc_timestamps function with various inputs"""
214216 for mode in ("us" , "ns" , "iso" ):
@@ -232,6 +234,7 @@ def test_strip_exc_timestamps_function(self):
232234 self .assertIn ("ZeroDivisionError: division by zero\n " , stripped_output )
233235 self .assertIn ("FakeError: not an exception\n " , stripped_output )
234236
237+ @force_not_colorized
235238 def test_strip_exc_timestamps_with_disabled_timestamps (self ):
236239 """Test the strip_exc_timestamps function when timestamps are disabled"""
237240 # Run with timestamps disabled
@@ -257,10 +260,7 @@ def test_strip_exc_timestamps_with_disabled_timestamps(self):
257260
258261 def test_timestamp_regex_pattern (self ):
259262 """Test the regex pattern used by strip_exc_timestamps"""
260- # Get the pattern from traceback module
261- from traceback import TIMESTAMP_AFTER_EXC_MSG_RE_GROUP
262-
263- pattern = re .compile (TIMESTAMP_AFTER_EXC_MSG_RE_GROUP )
263+ pattern = re .compile (TIMESTAMP_AFTER_EXC_MSG_RE_GROUP , flags = re .MULTILINE )
264264
265265 # Test microsecond format
266266 self .assertTrue (pattern .search (" <@1234567890.123456>" ))
0 commit comments