@@ -282,10 +282,11 @@ def run_in_test_thread():
282282
283283
284284def test__get_syncpoints (): # pragma: SYNCPOINT test_get_syncpoints
285- lines = enumerate (open (__file__ , "r" ), start = 1 )
286- for expected_lineno , line in lines : # pragma: NO BRANCH COVER
287- if "# pragma: SYNCPOINT test_get_syncpoints" in line :
288- break
285+ with open (__file__ , "r" ) as file :
286+ lines = enumerate (file , start = 1 )
287+ for expected_lineno , line in lines : # pragma: NO BRANCH COVER
288+ if "# pragma: SYNCPOINT test_get_syncpoints" in line :
289+ break
289290
290291 orchestrate ._get_syncpoints (__file__ )
291292 syncpoints = orchestrate ._SYNCPOINTS [__file__ ]["test_get_syncpoints" ]
@@ -327,10 +328,11 @@ def test__trace_this_source_file():
327328
328329 @staticmethod
329330 def test__trace_reach_syncpoint ():
330- lines = enumerate (open (__file__ , "r" ), start = 1 )
331- for syncpoint_lineno , line in lines : # pragma: NO BRANCH COVER
332- if "# pragma: SYNCPOINT test_get_syncpoints" in line :
333- break
331+ with open (__file__ , "r" ) as file :
332+ lines = enumerate (file , start = 1 )
333+ for syncpoint_lineno , line in lines : # pragma: NO BRANCH COVER
334+ if "# pragma: SYNCPOINT test_get_syncpoints" in line :
335+ break
334336
335337 orchestrate ._SYNCPOINTS .clear ()
336338 frame = mock .Mock (
0 commit comments