使用固定种子、不启动后台线程的引擎,适合纯功能单测。
()
| 38 | |
| 39 | @pytest.fixture |
| 40 | def engine_no_threads(): |
| 41 | """使用固定种子、不启动后台线程的引擎,适合纯功能单测。""" |
| 42 | eng = create_engine(seed=0, autostart=False) |
| 43 | yield eng |
| 44 | # 确保即使测试中意外设置了 running=True 也能安全清理 |
| 45 | eng.running = False |
| 46 | |
| 47 | |
| 48 | @pytest.fixture |
nothing calls this directly
no test coverage detected