File: test_cli.py

package info (click to toggle)
python-validate-pyproject 0.24.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,340 kB
  • sloc: python: 3,053; makefile: 46; sh: 25
file content (16 lines) | stat: -rw-r--r-- 494 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import traceback

import pytest

from validate_pyproject.pre_compile import cli


@pytest.mark.parametrize("replacements", ['["a", "b"]', "{invalid: json}"])
def test_invalid_replacements(tmp_path, replacements):
    with pytest.raises(SystemExit) as exc:
        cli.run(["-O", str(tmp_path), "-R", replacements])

    e = exc.value
    trace = "".join(traceback.format_exception(e.__class__, e, e.__traceback__))
    assert "--replacements: invalid" in trace
    assert replacements in trace