Skip to content

Commit 23e2538

Browse files
committed
test fixing when timestamps enabled
1 parent 4c031a6 commit 23e2538

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

Lib/test/test_pdb.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import unittest
1010
import subprocess
1111
import textwrap
12-
import traceback
1312
import linecache
1413
import zipapp
1514
import zipfile
@@ -4102,8 +4101,11 @@ def test_errors_in_command(self):
41024101
'debug doesnotexist',
41034102
'c',
41044103
])
4105-
stdout, _ = self.run_pdb_script('pass', commands + '\n')
4106-
stdout = traceback.strip_exc_timestamps(stdout)
4104+
stdout, _ = self.run_pdb_script(
4105+
'pass',
4106+
commands + '\n',
4107+
extra_env={'PYTHON_TRACEBACK_TIMESTAMPS':'0'},
4108+
)
41074109

41084110
self.assertEqual(stdout.splitlines()[1:], [
41094111
'-> pass',

Lib/traceback.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ def strip_exc_timestamps(output):
218218
else:
219219
pattern = TIMESTAMP_AFTER_EXC_MSG_RE_GROUP.encode()
220220
empty = b""
221-
return re.sub(pattern, empty, output)
221+
return re.sub(pattern, empty, output, flags=re.MULTILINE)
222222
return output
223223

224224

0 commit comments

Comments
 (0)