Skip to content

Commit

Permalink
Bump isort from 4.3.21 to 5.6.4 (#520)
Browse files Browse the repository at this point in the history
* Bump isort from 4.3.21 to 5.6.4

Bumps [isort](https://github.com/pycqa/isort) from 4.3.21 to 5.6.4.
- [Release notes](https://github.com/pycqa/isort/releases)
- [Changelog](https://github.com/PyCQA/isort/blob/develop/CHANGELOG.md)
- [Commits](PyCQA/isort@4.3.21...5.6.4)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* Reformat

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
  • Loading branch information
dependabot-preview[bot] and asvetlov committed Oct 21, 2020
1 parent c5c34d8 commit 556feed
Show file tree
Hide file tree
Showing 8 changed files with 64 additions and 25 deletions.
8 changes: 3 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@ lint flake: .flake

.flake:
flake8 aiodocker tests
if python -c "import sys; sys.exit(sys.version_info<(3,6))"; then \
black --check aiodocker tests setup.py; \
isort --check -rc aiodocker tests setup.py; \
fi
black --check aiodocker tests setup.py
isort --check aiodocker tests setup.py
mypy aiodocker tests

fmt:
isort -rc aiodocker tests setup.py
isort aiodocker tests setup.py
black aiodocker tests setup.py

develop:
Expand Down
14 changes: 11 additions & 3 deletions aiodocker/execs.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,19 @@ async def resize(self, *, h: Optional[int] = None, w: Optional[int] = None) -> N

@overload
def start(
self, *, timeout: aiohttp.ClientTimeout = None, detach: Literal[False] = False,
self,
*,
timeout: aiohttp.ClientTimeout = None,
detach: Literal[False] = False,
) -> Stream:
pass

@overload # noqa
async def start(
self, *, timeout: aiohttp.ClientTimeout = None, detach: Literal[True],
self,
*,
timeout: aiohttp.ClientTimeout = None,
detach: Literal[True],
) -> bytes:
pass

Expand Down Expand Up @@ -95,7 +101,9 @@ async def setup() -> Tuple[URL, bytes, bool]:
return Stream(self.docker, setup, timeout)

async def _start_detached(
self, timeout: aiohttp.ClientTimeout = None, tty: bool = False,
self,
timeout: aiohttp.ClientTimeout = None,
tty: bool = False,
) -> bytes:
if self._tty is None:
await self.inspect() # should restore tty
Expand Down
6 changes: 5 additions & 1 deletion aiodocker/images.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,11 @@ def build( # noqa: F811
params.update({"labels": json.dumps(labels)})

cm = self.docker._query(
"build", "POST", params=clean_map(params), headers=headers, data=data,
"build",
"POST",
params=clean_map(params),
headers=headers,
data=data,
)
return self._handle_response(cm, stream)

Expand Down
2 changes: 1 addition & 1 deletion aiodocker/logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@


if TYPE_CHECKING:
from .docker import Docker
from .containers import DockerContainer
from .docker import Docker


class DockerLog:
Expand Down
3 changes: 2 additions & 1 deletion aiodocker/stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ async def _init(self) -> None:
else:
msg = msg + f" Body: [{body!r}]"
raise DockerError(
500, {"message": msg},
500,
{"message": msg},
)
protocol = conn.protocol
loop = resp._loop
Expand Down
2 changes: 1 addition & 1 deletion requirements/test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ pytest-asyncio==0.14.0
flake8==3.8.4
mypy==0.790
black==20.8b1
isort==4.3.21
isort==5.6.4
-r ci.txt
36 changes: 30 additions & 6 deletions tests/test_execs.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ async def test_exec_attached(shell_container, stderr):
cmd = ["python", "-c", "print('Hello')"]

execute = await shell_container.exec(
stdout=True, stderr=True, stdin=True, tty=False, cmd=cmd,
stdout=True,
stderr=True,
stdin=True,
tty=False,
cmd=cmd,
)
async with execute.start(detach=False) as stream:
msg = await stream.read_out()
Expand All @@ -52,7 +56,11 @@ async def test_exec_attached(shell_container, stderr):
)
async def test_exec_attached_tty(shell_container):
execute = await shell_container.exec(
stdout=True, stderr=True, stdin=True, tty=True, cmd=["python", "-q"],
stdout=True,
stderr=True,
stdin=True,
tty=True,
cmd=["python", "-q"],
)
async with execute.start(detach=False) as stream:
await execute.resize(w=80, h=25)
Expand Down Expand Up @@ -84,15 +92,23 @@ async def test_exec_detached(shell_container, tty, stderr):
cmd = ["python", "-c", "print('Hello')"]

execute = await shell_container.exec(
stdout=True, stderr=True, stdin=False, tty=tty, cmd=cmd,
stdout=True,
stderr=True,
stdin=False,
tty=tty,
cmd=cmd,
)
assert await execute.start(detach=True) == b""


@pytest.mark.asyncio
async def test_exec_resize(shell_container):
execute = await shell_container.exec(
stdout=True, stderr=True, stdin=True, tty=True, cmd=["python"],
stdout=True,
stderr=True,
stdin=True,
tty=True,
cmd=["python"],
)
await execute.start(detach=True)
await execute.resize(w=120, h=10)
Expand Down Expand Up @@ -127,7 +143,11 @@ async def test_exec_inspect(shell_container):
@pytest.mark.asyncio
async def test_exec_restore_tty_attached(docker, shell_container):
exec1 = await shell_container.exec(
stdout=True, stderr=True, stdin=True, tty=True, cmd=["python"],
stdout=True,
stderr=True,
stdin=True,
tty=True,
cmd=["python"],
)

exec2 = docker.containers.exec(exec1.id)
Expand All @@ -139,7 +159,11 @@ async def test_exec_restore_tty_attached(docker, shell_container):
@pytest.mark.asyncio
async def test_exec_restore_tty_detached(docker, shell_container):
exec1 = await shell_container.exec(
stdout=True, stderr=True, stdin=True, tty=True, cmd=["python"],
stdout=True,
stderr=True,
stdin=True,
tty=True,
cmd=["python"],
)

exec2 = docker.containers.exec(exec1.id)
Expand Down
18 changes: 11 additions & 7 deletions tests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,12 +409,16 @@ async def test_events(docker, image_name, event_loop):
break

# 'kill' event may be omitted
assert events_occurred == [
"create",
"start",
"kill",
"die",
"destroy",
] or events_occurred == ["create", "start", "die", "destroy"]
assert (
events_occurred
== [
"create",
"start",
"kill",
"die",
"destroy",
]
or events_occurred == ["create", "start", "die", "destroy"]
)

await docker.events.stop()

0 comments on commit 556feed

Please sign in to comment.