Skip to content

Commit 8d01178

Browse files
committed
Simplify error suffix
1 parent 06f3bcc commit 8d01178

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

tests/test_hydra.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1292,20 +1292,25 @@ def test_app_with_error_exception_sanitized(tmpdir: Any, monkeypatch: Any) -> No
12921292
# names for AttributeError. Unfortunately, it suggests private attributes like
12931293
# '_return_value'
12941294
# Python 3.13+ fixes this by not suggesting private attributes.
1295-
if sys.version_info >= (3, 12) and sys.version_info < (3, 13):
1296-
suggestion_suffix = r". Did you mean: '_return_value'\?"
1297-
else:
1298-
suggestion_suffix = r""
1295+
suggestion_suffix = (
1296+
r"" if sys.version_info != (3, 12) else r". Did you mean: '_return_value'\?"
1297+
)
1298+
1299+
# Python 3.13 changed the traceback format for error indicators
1300+
first_traceback_line = r"foo\(cfg\)"
1301+
1302+
if sys.version_info >= (3, 13):
1303+
first_traceback_line += r"\n ~~~\^\^+\^+"
12991304

13001305
expected_regex = dedent(
13011306
rf"""
13021307
Error executing job with overrides: \[\]
13031308
Traceback \(most recent call last\):
13041309
File ".*my_app\.py", line 13, in my_app
1305-
foo\(cfg\)
1310+
{first_traceback_line}
13061311
File ".*my_app\.py", line 8, in foo
1307-
cfg\.foo = "bar" # does not exist in the config(
1308-
\^+)?
1312+
cfg\.foo = "bar" # does not exist in the config
1313+
\^+
13091314
omegaconf\.errors\.ConfigAttributeError: Key 'foo' is not in struct
13101315
full_key: foo
13111316
object_type=dict{suggestion_suffix}

0 commit comments

Comments
 (0)