test_tracebacks.py
This file
Path
tests/test_tracebacks.py
52 lines · 2.0 KiB · Python
Last changed by
🔧 Migrate from Black, isort, flake8, autoflake, pyupgrade to Ruff (#763)Sebastián Ramírezbefore adoption38b8e4a
History of this fileTake it
The walk stopped after 200 commits: lines older than b988f6f point at it.
👷 Move from pytest-cov to coverage and Codecov to Smokeshow (#483)Sebastián Ramírezbefore adoptionb988f6f
lines 1–2why, one step back1import os2import subprocess👷♂️ Consistently use `sys.executable` to run subprocesses, needed by OpenSUSE (#408)Matthias Bachbefore adoption416c612
line 3why, one step back3import sys👷 Move from pytest-cov to coverage and Codecov to Smokeshow (#483)Sebastián Ramírezbefore adoptionb988f6f
lines 4–9why, one step back4from pathlib import Path567def test_traceback_no_rich():8 file_path = Path(__file__).parent / "assets/type_error_no_rich.py"9 result = subprocess.run(👷♂️ Consistently use `sys.executable` to run subprocesses, needed by OpenSUSE (#408)Matthias Bachbefore adoption416c612
line 10why, one step back10 [sys.executable, "-m", "coverage", "run", str(file_path)],🔧 Migrate from Black, isort, flake8, autoflake, pyupgrade to Ruff (#763)Sebastián Ramírezbefore adoption38b8e4a
line 11why, one step back11 capture_output=True,👷 Move from pytest-cov to coverage and Codecov to Smokeshow (#483)Sebastián Ramírezbefore adoptionb988f6f
lines 12–18why, one step back12 encoding="utf-8",13 env={**os.environ, "_TYPER_STANDARD_TRACEBACK": ""},14 )15 assert "return get_command(self)(*args, **kwargs)" not in result.stderr1617 assert "typer.run(main)" in result.stderr18 assert "print(name + 3)" in result.stderr🔥 Remove support for Python 3.6 (#758)Sebastián Ramírezbefore adoption13404a0
line 19why, one step back19 assert 'TypeError: can only concatenate str (not "int") to str' in result.stderr👷 Move from pytest-cov to coverage and Codecov to Smokeshow (#483)Sebastián Ramírezbefore adoptionb988f6f
lines 20–24why, one step back202122def test_traceback_no_rich_short_disable():23 file_path = Path(__file__).parent / "assets/type_error_no_rich_short_disable.py"24 result = subprocess.run(👷♂️ Consistently use `sys.executable` to run subprocesses, needed by OpenSUSE (#408)Matthias Bachbefore adoption416c612
line 25why, one step back25 [sys.executable, "-m", "coverage", "run", str(file_path)],🔧 Migrate from Black, isort, flake8, autoflake, pyupgrade to Ruff (#763)Sebastián Ramírezbefore adoption38b8e4a
line 26why, one step back26 capture_output=True,👷 Move from pytest-cov to coverage and Codecov to Smokeshow (#483)Sebastián Ramírezbefore adoptionb988f6f
lines 27–33why, one step back27 encoding="utf-8",28 env={**os.environ, "_TYPER_STANDARD_TRACEBACK": ""},29 )30 assert "return get_command(self)(*args, **kwargs)" not in result.stderr3132 assert "app()" in result.stderr33 assert "print(name + 3)" in result.stderr🔥 Remove support for Python 3.6 (#758)Sebastián Ramírezbefore adoption13404a0
line 34why, one step back34 assert 'TypeError: can only concatenate str (not "int") to str' in result.stderr👷 Move from pytest-cov to coverage and Codecov to Smokeshow (#483)Sebastián Ramírezbefore adoptionb988f6f
lines 35–39why, one step back353637def test_unmodified_traceback():38 file_path = Path(__file__).parent / "assets/type_error_normal_traceback.py"39 result = subprocess.run(👷♂️ Consistently use `sys.executable` to run subprocesses, needed by OpenSUSE (#408)Matthias Bachbefore adoption416c612
line 40why, one step back40 [sys.executable, "-m", "coverage", "run", str(file_path)],🔧 Migrate from Black, isort, flake8, autoflake, pyupgrade to Ruff (#763)Sebastián Ramírezbefore adoption38b8e4a
line 41why, one step back41 capture_output=True,👷 Move from pytest-cov to coverage and Codecov to Smokeshow (#483)Sebastián Ramírezbefore adoptionb988f6f
lines 42–51why, one step back42 encoding="utf-8",43 env={**os.environ, "_TYPER_STANDARD_TRACEBACK": ""},44 )45 assert "morty" in result.stdout, "the call to the first app should work normally"46 assert "return callback(**use_params)" in result.stderr, (47 "calling outside of Typer should show the normal traceback, "48 "even after the hook is installed"49 )50 assert "typer.main.get_command(broken_app)()" in result.stderr51 assert "print(name + 3)" in result.stderr🔥 Remove support for Python 3.6 (#758)Sebastián Ramírezbefore adoption13404a0
line 52why, one step back52 assert 'TypeError: can only concatenate str (not "int") to str' in result.stderr