1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
"""Tests for libtmux's test constants."""
from __future__ import annotations
from typing import TYPE_CHECKING
from libtmux.test.constants import (
RETRY_INTERVAL_SECONDS,
RETRY_TIMEOUT_SECONDS,
TEST_SESSION_PREFIX,
)
if TYPE_CHECKING:
import pytest
def test_test_session_prefix() -> None:
"""Test TEST_SESSION_PREFIX is correctly defined."""
assert TEST_SESSION_PREFIX == "libtmux_"
def test_retry_timeout_seconds_default() -> None:
"""Test RETRY_TIMEOUT_SECONDS default value."""
assert RETRY_TIMEOUT_SECONDS == 8
def test_retry_timeout_seconds_env(monkeypatch: pytest.MonkeyPatch) -> None:
"""Test RETRY_TIMEOUT_SECONDS can be configured via environment variable."""
monkeypatch.setenv("RETRY_TIMEOUT_SECONDS", "10")
from importlib import reload
import libtmux.test.constants
reload(libtmux.test.constants)
assert libtmux.test.constants.RETRY_TIMEOUT_SECONDS == 10
def test_retry_interval_seconds_default() -> None:
"""Test RETRY_INTERVAL_SECONDS default value."""
assert RETRY_INTERVAL_SECONDS == 0.05
def test_retry_interval_seconds_env(monkeypatch: pytest.MonkeyPatch) -> None:
"""Test RETRY_INTERVAL_SECONDS can be configured via environment variable."""
monkeypatch.setenv("RETRY_INTERVAL_SECONDS", "0.1")
from importlib import reload
import libtmux.test.constants
reload(libtmux.test.constants)
assert libtmux.test.constants.RETRY_INTERVAL_SECONDS == 0.1
|