File: test_explicit_configs.py

package info (click to toggle)
pytest-mypy-plugins 3.2.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 296 kB
  • sloc: python: 1,287; sh: 15; makefile: 3
file content (50 lines) | stat: -rw-r--r-- 1,353 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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import subprocess
from pathlib import Path
from typing import Final

import pytest

_PYPROJECT1: Final = str(Path(__file__).parent / "test_configs" / "pyproject1.toml")
_PYPROJECT2: Final = str(Path(__file__).parent / "test_configs" / "pyproject2.toml")
_MYPYINI1: Final = str(Path(__file__).parent / "test_configs" / "mypy1.ini")
_MYPYINI2: Final = str(Path(__file__).parent / "test_configs" / "mypy2.ini")
_SETUPCFG1: Final = str(Path(__file__).parent / "test_configs" / "setup1.cfg")
_SETUPCFG2: Final = str(Path(__file__).parent / "test_configs" / "setup2.cfg")

_TEST_FILE: Final = str(Path(__file__).parent / "test-mypy-config.yml")


@pytest.mark.parametrize("config_file", [_PYPROJECT1, _PYPROJECT2])
def test_pyproject_toml(config_file: str) -> None:
    subprocess.check_output(
        [
            "python3",
            "-m",
            "pytest",
            "--mypy-pyproject-toml-file",
            config_file,
            _TEST_FILE,
        ]
    )


@pytest.mark.parametrize(
    "config_file",
    [
        _MYPYINI1,
        _MYPYINI2,
        _SETUPCFG1,
        _SETUPCFG2,
    ],
)
def test_ini_files(config_file: str) -> None:
    subprocess.check_output(
        [
            "python3",
            "-m",
            "pytest",
            "--mypy-ini-file",
            config_file,
            _TEST_FILE,
        ]
    )