File: conftest.py

package info (click to toggle)
python-briefcase 0.3.22-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,300 kB
  • sloc: python: 59,405; makefile: 57
file content (28 lines) | stat: -rw-r--r-- 684 bytes parent folder | download | duplicates (2)
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
import os
from unittest import mock

import pytest

from briefcase.console import Console


@pytest.fixture
def console(monkeypatch) -> Console:
    console = Console()
    console._console_impl.input = mock.MagicMock(spec_set=input)
    # default console is always interactive
    monkeypatch.setattr(os, "isatty", lambda _: True)
    return console


@pytest.fixture
def disabled_console() -> Console:
    console = Console(input_enabled=False)
    console._console_impl.input = mock.MagicMock(spec_set=input)
    return console


@pytest.fixture
def non_interactive_console(console, monkeypatch) -> Console:
    monkeypatch.setattr(os, "isatty", lambda _: False)
    yield console