File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed
unit_tests/sources/declarative/decoders Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -227,13 +227,15 @@ def test_composite_raw_decoder_csv_parser_without_mocked_response():
227227 httpd = HTTPServer (("localhost" , 8080 ), TestServer )
228228 thread = Thread (target = httpd .serve_forever , args = ())
229229 thread .start ()
230-
231- response = requests .get ("http://localhost:8080" , stream = True )
232- result = list (CompositeRawDecoder (parser = CsvParser ()).decode (response ))
233-
234- assert len (result ) == 1
235- httpd .shutdown () # release port and kill the thread
236-
230+ thread .start ()
231+ try :
232+ response = requests .get (f"http://localhost:{ port } " , stream = True )
233+ result = list (CompositeRawDecoder (parser = CsvParser ()).decode (response ))
234+
235+ assert len (result ) == 1
236+ finally :
237+ httpd .shutdown () # release port and kill the thread
238+ thread .join (timeout = 5 ) # ensure thread is cleaned up
237239
238240def test_given_response_already_consumed_when_decode_then_no_data_is_returned (requests_mock ):
239241 requests_mock .register_uri (
You can’t perform that action at this time.
0 commit comments