File: conftest.py

package info (click to toggle)
tmuxp 1.64.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,500 kB
  • sloc: python: 17,788; sh: 22; makefile: 6
file content (32 lines) | stat: -rw-r--r-- 859 bytes parent folder | download | duplicates (3)
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
"""Shared pytest fixtures for _internal tests."""

from __future__ import annotations

import pytest

from tmuxp._internal.colors import ColorMode, Colors

# ANSI escape codes for test assertions
# These constants improve test readability by giving semantic names to color codes
ANSI_GREEN = "\033[32m"
ANSI_RED = "\033[31m"
ANSI_YELLOW = "\033[33m"
ANSI_BLUE = "\033[34m"
ANSI_MAGENTA = "\033[35m"
ANSI_CYAN = "\033[36m"
ANSI_BRIGHT_CYAN = "\033[96m"
ANSI_RESET = "\033[0m"
ANSI_BOLD = "\033[1m"


@pytest.fixture
def colors_always(monkeypatch: pytest.MonkeyPatch) -> Colors:
    """Colors instance with ALWAYS mode and NO_COLOR cleared."""
    monkeypatch.delenv("NO_COLOR", raising=False)
    return Colors(ColorMode.ALWAYS)


@pytest.fixture
def colors_never() -> Colors:
    """Colors instance with colors disabled."""
    return Colors(ColorMode.NEVER)