summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDanny McClanahan <1305167+cosmicexplorer@users.noreply.github.com>2022-10-24 13:08:18 -0400
committerGitHub <noreply@github.com>2022-10-24 17:08:18 +0000
commit0b971a1aef2fa27574d3c7c5f1a8a2eed6c2c1ec (patch)
treeb9b44e276d9d981a43ad7ecb82eaa953929f6288 /lib
parenta51bd80a5ed62919376fe19019cf98c54dc4232e (diff)
downloadspack-0b971a1aef2fa27574d3c7c5f1a8a2eed6c2c1ec.tar.gz
spack-0b971a1aef2fa27574d3c7c5f1a8a2eed6c2c1ec.tar.bz2
spack-0b971a1aef2fa27574d3c7c5f1a8a2eed6c2c1ec.tar.xz
spack-0b971a1aef2fa27574d3c7c5f1a8a2eed6c2c1ec.zip
redact line numbers from grouped exception message (#33485)
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/test/llnl/util/lang.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/spack/spack/test/llnl/util/lang.py b/lib/spack/spack/test/llnl/util/lang.py
index bced121136..63090caa38 100644
--- a/lib/spack/spack/test/llnl/util/lang.py
+++ b/lib/spack/spack/test/llnl/util/lang.py
@@ -4,6 +4,7 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os.path
+import re
import sys
from datetime import datetime, timedelta
from textwrap import dedent
@@ -307,22 +308,25 @@ def test_grouped_exception():
top-level raised TypeError: ok"""
)
+ full_message = h.grouped_message(with_tracebacks=True)
+ no_line_numbers = re.sub(r"line [0-9]+,", "line xxx,", full_message)
+
assert (
- h.grouped_message(with_tracebacks=True)
+ no_line_numbers
== dedent(
"""\
due to the following failures:
inner method raised ValueError: wow!
File "{0}", \
-line 298, in test_grouped_exception
+line xxx, in test_grouped_exception
inner()
File "{0}", \
-line 295, in inner
+line xxx, in inner
raise ValueError("wow!")
top-level raised TypeError: ok
File "{0}", \
-line 301, in test_grouped_exception
+line xxx, in test_grouped_exception
raise TypeError("ok")
"""
).format(__file__)