File: fake_kernelmanager.py

package info (click to toggle)
nbclient 0.10.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 776 kB
  • sloc: python: 2,946; makefile: 18
file content (22 lines) | stat: -rw-r--r-- 865 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
from jupyter_client.manager import AsyncKernelManager

# mypy: disable-error-code="no-untyped-call,no-untyped-def"


class FakeCustomKernelManager(AsyncKernelManager):
    expected_methods = {"__init__": 0, "client": 0, "start_kernel": 0}  # noqa

    def __init__(self, *args, **kwargs):
        self.log.info("FakeCustomKernelManager initialized")
        self.expected_methods["__init__"] += 1
        super().__init__(*args, **kwargs)

    async def start_kernel(self, *args, **kwargs):
        self.log.info("FakeCustomKernelManager started a kernel")
        self.expected_methods["start_kernel"] += 1
        return await super().start_kernel(*args, **kwargs)

    def client(self, *args, **kwargs):
        self.log.info("FakeCustomKernelManager created a client")
        self.expected_methods["client"] += 1
        return super().client(*args, **kwargs)