Skip to content

Commit

Permalink
fix test cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
blink1073 committed Dec 17, 2023
1 parent 882f331 commit a761bdc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,7 @@ filterwarnings= [
# Fail on warnings
"error",
# from python-dateutil
"ignore:datetime.datetime.utcfromtimestamp:DeprecationWarning",
"ignore:datetime.datetime.utcnow:DeprecationWarning",
"ignore:datetime.datetime.utc:DeprecationWarning",
]

[tool.coverage.report]
Expand Down
8 changes: 7 additions & 1 deletion tests/test_multikernelmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ def _run_lifecycle(km, test_kid=None):
km.shutdown_kernel(kid, now=True)
assert kid not in km, f"{kid} not in {km}"
kc.stop_channels()
km.context.destroy()

def _run_cinfo(self, km, transport, ip):
kid = km.start_kernel(stdout=PIPE, stderr=PIPE)
Expand Down Expand Up @@ -285,13 +286,16 @@ async def _run_lifecycle(km, test_kid=None):
await fut
assert kid in km.list_kernel_ids()
k = km.get_kernel(kid)
kc = k.client()
assert isinstance(k, AsyncKernelManager)
await km.shutdown_kernel(kid, now=True)
assert kid not in km, f"{kid} not in {km}"
kc.stop_channels()
km.context.destroy()

async def _run_cinfo(self, km, transport, ip):
kid = await km.start_kernel(stdout=PIPE, stderr=PIPE)
km.get_kernel(kid)
k = km.get_kernel(kid)
cinfo = km.get_connection_info(kid)
assert transport == cinfo["transport"]
assert ip == cinfo["ip"]
Expand All @@ -305,8 +309,10 @@ async def _run_cinfo(self, km, transport, ip):
assert "hb_port" in cinfo
stream = km.connect_hb(kid)
stream.close()
kc = k.client()
await km.shutdown_kernel(kid, now=True)
assert kid not in km
kc.stop_channels()

async def test_tcp_lifecycle(self):
await self.raw_tcp_lifecycle()
Expand Down

0 comments on commit a761bdc

Please sign in to comment.