Skip to content

Commit

Permalink
Fixups after merging
Browse files Browse the repository at this point in the history
  • Loading branch information
smurfix committed Nov 21, 2023
1 parent ee10aad commit a92b4b0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/asyncclick/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -739,15 +739,15 @@ async def invoke(
...

@t.overload
def invoke(
async def invoke(
__self, # noqa: B902
__callback: "Command",
*args: t.Any,
**kwargs: t.Any,
) -> t.Any:
...

def invoke(
async def invoke(
__self, # noqa: B902
__callback: t.Union["Command", "t.Callable[..., V]"],
*args: t.Any,
Expand Down
9 changes: 5 additions & 4 deletions tests/test_imports.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,19 @@
def tracking_import(module, locals=None, globals=None, fromlist=None,
level=0):
rv = real_import(module, locals, globals, fromlist, level)
if globals and globals['__name__'].startswith('click') and level == 0:
if globals and '__name__' in globals and globals['__name__'].startswith('asyncclick') and level == 0:
found_imports.add(module)
return rv
builtins.__import__ = tracking_import
import asyncclick as click
import asyncclick
rv = list(found_imports)
import json
click.echo(json.dumps(rv))
asyncclick.echo(json.dumps(rv))
"""

ALLOWED_IMPORTS = {
"anyio",
"weakref",
"os",
"struct",
Expand Down Expand Up @@ -63,6 +64,6 @@ def test_light_imports():
imported = json.loads(rv)

for module in imported:
if module == "click" or module.startswith("click."):
if module == "asyncclick" or module.startswith("asyncclick."):
continue
assert module in ALLOWED_IMPORTS
1 change: 1 addition & 0 deletions tests/test_shell_completion.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import pytest

import asyncclick as click
import asyncclick.shell_completion
from asyncclick.core import Argument
from asyncclick.core import Command
Expand Down

0 comments on commit a92b4b0

Please sign in to comment.