File: conftest.py

package info (click to toggle)
textual-image 0.8.5-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 2,468 kB
  • sloc: python: 1,851; makefile: 2
file content (19 lines) | stat: -rw-r--r-- 556 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
from typing import Iterator
from unittest.mock import patch

from pytest import fixture


# We mock stdin to be closed per default. The test code would get quite messy otherwise.
# Tests that need another value can just override it.
@fixture(scope="session", autouse=True)
def close_stdin() -> Iterator[None]:
    with patch("sys.__stdin__", None):
        yield


@fixture(scope="session", autouse=True)
def mock_cell_size() -> None:
    from textual_image._terminal import CellSize, get_cell_size

    setattr(get_cell_size, "_result", CellSize(10, 20))