mirror of
https://github.com/tiennm99/DocsGPT.git
synced 2026-10-19 06:14:42 +00:00
feat: better shutdowns
This commit is contained in:
1 parent
547d1a9036
commit
1f06f31aa3
10 files changed
+447
-3
No files matched your search
@@ -0,0 +1,37 @@
|
||||
"""Unit tests for the process-wide graceful-shutdown flag."""
|
||||
|
||||
import pytest
|
||||
|
||||
from application.core import shutdown
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def _reset_flag():
|
||||
shutdown.reset_shutdown()
|
||||
yield
|
||||
shutdown.reset_shutdown()
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
def test_flag_starts_clear():
|
||||
assert shutdown.is_shutting_down() is False
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
def test_begin_shutdown_sets_flag():
|
||||
shutdown.begin_shutdown()
|
||||
assert shutdown.is_shutting_down() is True
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
def test_begin_shutdown_is_idempotent():
|
||||
shutdown.begin_shutdown()
|
||||
shutdown.begin_shutdown()
|
||||
assert shutdown.is_shutting_down() is True
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
def test_reset_clears_flag():
|
||||
shutdown.begin_shutdown()
|
||||
shutdown.reset_shutdown()
|
||||
assert shutdown.is_shutting_down() is False
|
||||
Reference in new issue
Block a user