Skip to content

Commit

Permalink
fix(serial.py): Pytest-embedded leaks file descriptors when used with…
Browse files Browse the repository at this point in the history
… pytest-lazy-fixture
  • Loading branch information
JammuKekkonen authored and igor udot (horw) committed Oct 24, 2023
1 parent ea7157f commit 4e89804
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pytest-embedded-serial/pytest_embedded_serial/serial.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ def stop_redirect_thread(self) -> bool:
if self._redirect_thread and self._redirect_thread.is_alive():
self._redirect_thread.terminate()
killed = True
del self._redirect_thread

return killed

Expand Down Expand Up @@ -189,6 +190,9 @@ def _event_loop(self):
elif _e == 'start':
self._block_reading = False
elif _e == 'end':
self._event_q.close()
while not self._event_q.empty():
_ = self._event_q.get_nowait()
return

time.sleep(0.05) # set interval
Expand Down

0 comments on commit 4e89804

Please sign in to comment.