Skip to content
This repository was archived by the owner on Aug 13, 2026. It is now read-only.
Prev Previous commit
Next Next commit
Fixed unit test issues.
  • Loading branch information
gkevinzheng committed Mar 10, 2025
commit d725effc0ab9baf411fb7f0d6fd73bf7b9bc1a26
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,6 @@ def _close(self):
if self.stop(grace_period=self._grace_period) and threading.main_thread().is_alive():
print("Sent all pending logs.", file=sys.stderr)
else:
print(f"Thread main is alive: {threading.main_thread().is_alive()}", file=sys.stderr)
print(
"Failed to send %d pending logs." % (self._queue.qsize(),),
file=sys.stderr,
Expand Down
9 changes: 2 additions & 7 deletions tests/unit/handlers/transports/test_background_thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,12 +332,6 @@ def test__close_main_thread_not_alive(self):

self.assertRegex(stderr_mock.getvalue(), re.compile("^%s$" % _CLOSE_THREAD_SHUTDOWN_ERROR_MSG, re.MULTILINE))

print(worker._grace_period)
print(worker._queue.qsize())
print(stderr_mock.getvalue())
self.assertFalse(worker.is_alive)
self.fail()

def test_close_unregister_atexit(self):
worker = self._make_one(_Logger(self.NAME))

Expand Down Expand Up @@ -467,7 +461,8 @@ def test__thread_main_main_thread_terminated(self):
main_thread_obj_mock = mock.Mock()
main_thread_func_mock.return_value = main_thread_obj_mock
main_thread_obj_mock.is_alive = mock.Mock(return_value=False)

self._enqueue_record(worker, "1")
self._enqueue_record(worker, "2")
worker._thread_main()

self.assertFalse(worker._cloud_logger._batch.commit_called)
Expand Down