fed8b2eed7
Backend release / release (push) Waiting to run
Bandit Security Scan / bandit_scan (push) Waiting to run
Build and push multi-arch DocsGPT Docker image / build (linux/amd64, ubuntu-latest, amd64) (push) Waiting to run
Build and push multi-arch DocsGPT Docker image / build (linux/arm64, ubuntu-24.04-arm, arm64) (push) Waiting to run
Build and push multi-arch DocsGPT Docker image / manifest (push) Blocked by required conditions
Build and push DocsGPT FE Docker image for development / build (linux/amd64, ubuntu-latest, amd64) (push) Waiting to run
Build and push DocsGPT FE Docker image for development / build (linux/arm64, ubuntu-24.04-arm, arm64) (push) Waiting to run
Build and push DocsGPT FE Docker image for development / manifest (push) Blocked by required conditions
Python linting / ruff (push) Waiting to run
Run python tests with pytest / Run tests and count coverage (3.12) (push) Waiting to run
React Widget Build / build (push) Waiting to run
38 lines
795 B
Python
38 lines
795 B
Python
"""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
|