Coverage for tests / unit / utils / async_tool_executor / test_shutdown.py: 100%

13 statements  

« prev     ^ index     » next       coverage.py v7.13.0, created at 2026-04-03 18:53 +0000

1"""Tests for shutdown functionality.""" 

2 

3from __future__ import annotations 

4 

5from assertpy import assert_that 

6 

7from lintro.utils.async_tool_executor import AsyncToolExecutor 

8 

9 

10def test_shutdown_closes_thread_pool() -> None: 

11 """Test that shutdown properly closes the thread pool.""" 

12 exec_instance = AsyncToolExecutor(max_workers=2) 

13 

14 assert_that(exec_instance._executor).is_not_none() 

15 

16 exec_instance.shutdown() 

17 

18 assert_that(exec_instance._executor).is_none() 

19 

20 

21def test_shutdown_can_be_called_multiple_times() -> None: 

22 """Test that shutdown is idempotent.""" 

23 exec_instance = AsyncToolExecutor(max_workers=2) 

24 

25 exec_instance.shutdown() 

26 exec_instance.shutdown() # Should not raise 

27 

28 assert_that(exec_instance._executor).is_none()