File: conftest.py

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

import pytest

from briefcase.commands.base import BaseCommand
from briefcase.console import Console
from briefcase.integrations.subprocess import Subprocess
from briefcase.platforms.macOS.app import macOSAppMixin, macOSCreateMixin
from tests.utils import DummyConsole


class DummyInstallCommand(macOSAppMixin, macOSCreateMixin, BaseCommand):
    """A dummy command to expose package installation capabilities."""

    command = "install"

    def __init__(self, base_path, **kwargs):
        kwargs.setdefault("console", Console())
        super().__init__(base_path=base_path / "base_path", **kwargs)
        self.tools.console = DummyConsole()


@pytest.fixture
def dummy_command(tmp_path):
    cmd = DummyInstallCommand(base_path=tmp_path)

    cmd.tools.subprocess = mock.MagicMock(spec_set=Subprocess)

    return cmd