Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 0 additions & 21 deletions tests/test_termui.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,27 +103,6 @@ def main() -> None:
assert os.environ.get(env_key) == "present"


@pytest.mark.parametrize(
("runner_exc", "invoke_exc"),
[
(False, None),
(True, False),
],
)
def test_clirunner_invoke_catch_exceptions(
runner_exc: bool, invoke_exc: bool | None
) -> None:
runner = CliRunner(catch_exceptions=runner_exc)
app = typer.Typer()

@app.command()
def main() -> None:
raise RuntimeError("boom")

with pytest.raises(RuntimeError, match="boom"):
runner.invoke(app, [], catch_exceptions=invoke_exc)


@pytest.mark.parametrize(
("exit_value", "expected_exit_code", "expected_stdout"),
[
Expand Down
13 changes: 1 addition & 12 deletions tests/test_types_file.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import subprocess
import sys
from io import BytesIO, StringIO, TextIOWrapper
from io import BytesIO, StringIO
from pathlib import Path

import pytest
import typer
from typer._click._compat import get_best_encoding, should_strip_ansi
from typer._click.testing import make_input_stream
from typer._click.utils import PacifyFlushWrapper
from typer.testing import CliRunner

Expand Down Expand Up @@ -124,16 +123,6 @@ def test_filelike_conversion() -> None:
assert stream.getvalue() == "This is a single line\n"


def test_input_stream() -> None:
binary_stream = BytesIO(b"hello")
converted = make_input_stream(binary_stream, charset="utf-8")
assert converted is binary_stream

text_stream = TextIOWrapper(BytesIO(b"hello"), encoding="utf-8")
converted = make_input_stream(text_stream, charset="utf-8")
assert converted is text_stream.buffer


def test_binary_dash() -> None:
result = runner.invoke(app, ["write-binary", "--file-out=-"])
assert result.exit_code == 0
Expand Down
Loading
Loading