Skip to content

Commit 1dd1c71

Browse files
committed
[lldb] Update PythonDataObjectsTests for new exception formatting
PythonDataObjectsTest.TestExceptions started failing because the output of the python traceback printers is now consistent between python and cpython [1]. Work around the issue by supporting both variants. Thanks to Ismail for identifying the root cause. [1] python/cpython#85203 (cherry picked from commit 9dbce77)
1 parent 709acee commit 1dd1c71

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

lldb/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -802,10 +802,13 @@ def main():
802802

803803
PythonScript lol(script2);
804804

805-
EXPECT_THAT_EXPECTED(lol(),
806-
llvm::Failed<PythonException>(testing::Property(
807-
&PythonException::ReadBacktrace,
808-
testing::ContainsRegex("unprintable MyError"))));
805+
EXPECT_THAT_EXPECTED(
806+
lol(),
807+
llvm::Failed<PythonException>(testing::Property(
808+
&PythonException::ReadBacktrace,
809+
testing::AnyOf(
810+
testing::ContainsRegex("MyError: <exception str\\(\\) failed>"),
811+
testing::ContainsRegex("unprintable MyError")))));
809812

810813
#endif
811814
}

0 commit comments

Comments
 (0)