@@ -149,15 +149,18 @@ async def processor_0(
149149 # Using assertRaises removes the traceback which we want to check
150150 # includes the TaskGroup error.
151151 exception = None
152+ tb = None
152153 try :
153154 processor .apply_sync (
154155 processor_0 , content_api .ProcessorContent (['foo' , 'bar' ])
155156 )
156157 except ValueError as e :
157158 exception = str (e )
159+ tb = traceback .format_exc ()
158160
159161 # Assert that the error message isn't a generic ExceptionGroup message
160162 self .assertNotIn ('unhandled errors in a TaskGroup' , exception )
163+ self .assertIn ('unhandled errors in a TaskGroup' , tb )
161164 self .assertEqual (exception , err_msg )
162165
163166 def test_chained_part_processor_raises_specific_error_message (self ):
@@ -176,15 +179,18 @@ async def processor_0(
176179 # Using assertRaises removes the traceback which we want to check
177180 # includes the TaskGroup error.
178181 exception = None
182+ tb = None
179183 try :
180184 processor .apply_sync (
181185 combined_processor , [content_api .ProcessorPart ('bar' )]
182186 )
183187 except ValueError as e :
184188 exception = str (e )
189+ tb = traceback .format_exc ()
185190
186191 # Assert that the error message isn't a generic ExceptionGroup message
187192 self .assertNotIn ('unhandled errors in a TaskGroup' , exception )
193+ self .assertIn ('unhandled errors in a TaskGroup' , tb )
188194 self .assertEqual (exception , err_msg )
189195
190196 def test_normalization_function (self ):
@@ -999,24 +1005,6 @@ async def proc_c(
9991005 content = processor .apply_sync (chain_abc , inputs )
10001006 self .assertEqual (content , inputs )
10011007
1002- def test_backtrace_optimization (self ):
1003- @processor .part_processor_function
1004- async def fail (
1005- part : content_api .ProcessorPart ,
1006- ) -> AsyncIterable [content_api .ProcessorPart ]:
1007- raise ValueError ('foo is not allowed' )
1008- yield part # pylint: disable=unreachable
1009-
1010- p = processor .passthrough ()
1011-
1012- inputs = [content_api .ProcessorPart ('0' )]
1013- try :
1014- processor .apply_sync (p + p + fail , inputs )
1015- except ValueError :
1016- tb = traceback .format_exc ()
1017- self .assertIn ('foo is not allowed' , tb ) # pylint: disable=g-assert-in-except
1018- self .assertEqual (tb .count ('_normalize_part_stream\n ' ), 1 ) # pylint: disable=g-assert-in-except
1019-
10201008
10211009class ParallelProcessorsTest (TestWithProcessors , parameterized .TestCase ):
10221010
0 commit comments