Skip to content

Commit

Permalink
#88: Fix unrelated failing test of powershell autocomplete
Browse files Browse the repository at this point in the history
  • Loading branch information
borissmidt committed Jul 6, 2023
1 parent 32e5f3a commit 091e0db
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 15 deletions.
12 changes: 2 additions & 10 deletions tests/test_completion/test_completion_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@
from unittest import mock

import shellingham
import typer
from typer.testing import CliRunner

from docs_src.commands.index import tutorial001 as mod
from typer.testing import CliRunner

runner = CliRunner()
app = typer.Typer()
app.command()(mod.main)
app = mod.app


def test_completion_install_no_shell():
Expand Down Expand Up @@ -144,12 +142,6 @@ def test_completion_install_fish():
assert "completion installed in" in result.stdout
assert "Completion will take effect once you restart the terminal" in result.stdout


runner = CliRunner()
app = typer.Typer()
app.command()(mod.main)


def test_completion_install_powershell():
completion_path: Path = (
Path.home() / f".config/powershell/Microsoft.PowerShell_profile.ps1"
Expand Down
7 changes: 2 additions & 5 deletions typer/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,7 @@
except ImportError: # pragma: nocover
rich = None # type: ignore

try:
from asyncio import Loop
except ImportError: # pragma: nocover
Loop = Any # type: ignore
from asyncio import AbstractEventLoop

_original_except_hook = sys.excepthook
_typer_developer_exception_attr_name = "__typer_developer_exception__"
Expand Down Expand Up @@ -145,7 +142,7 @@ def __init__(
pretty_exceptions_enable: bool = True,
pretty_exceptions_show_locals: bool = True,
pretty_exceptions_short: bool = True,
loop_factory: Optional[Callable[[], Loop]] = None,
loop_factory: Optional[Callable[[], AbstractEventLoop]] = None,
):
self._add_completion = add_completion
self.rich_markup_mode: MarkupMode = rich_markup_mode
Expand Down

0 comments on commit 091e0db

Please sign in to comment.