[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] https://github.com/python/cpython/issues/85203
This commit is contained in:
Jonas Devlieghere committed 2023-03-15 15:53:18 -07:00
1 parent e35c71493b
commit 9dbce774ee
1 file changed
+7 -4
@@ -802,10 +802,13 @@ def main():
PythonScript lol(script2);
EXPECT_THAT_EXPECTED(lol(),
llvm::Failed<PythonException>(testing::Property(
&PythonException::ReadBacktrace,
testing::ContainsRegex("unprintable MyError"))));
EXPECT_THAT_EXPECTED(
lol(),
llvm::Failed<PythonException>(testing::Property(
&PythonException::ReadBacktrace,
testing::AnyOf(
testing::ContainsRegex("MyError: <exception str\\(\\) failed>"),
testing::ContainsRegex("unprintable MyError")))));
#endif
}