gray-shoe-19951
12/14/2022, 12:32 AM@testbook(PATH_NOTEBOOKS / "prep.ipynb", execute=True)
def test_prep_notebook(tb: TestbookNotebookClient):
print_notebook_output(tb)
The error is like
/.cache/pants/named_caches/pex_root/venvs/s/86f08450/venv/lib/python3.9/site-packages/jupyter_client/client.py:202: in _async_wait_for_ready
raise RuntimeError("Kernel died before replying to kernel_info")
E RuntimeError: Kernel died before replying to kernel_info
How to solve this issue? Thanks you!gray-shoe-19951
12/14/2022, 2:30 PMenough-analyst-54434
12/14/2022, 2:39 PM@testbook
decorator for one - I have never heard of such a thing, and a suspicious looking constant PATH_NOTEBOOKS
- and it's semi-well-known Pants does not play well with certain paths, namely because Pants executes nothing except the run
(and maybe repl
?) goals in the CWD. Everything else executes from an ephemeral /tmp/*
dir where the files needed by the process - and only those files - are copied there. This includes tests.
Given that ... can you say more about those test lines?gray-shoe-19951
12/14/2022, 2:57 PMPATH_NOTEBOOKS
is just a dir constants. We have declare the resource for it and add it to the dependencies into our tests. I believe Pants is able to find them. Here the issue seems to me is that Pants is not running notebook well for some issue on subprocess (e.g. the error message seems complaining the kernel from running notebook). Btw, the test is passed if I just run it using pytest instead of pants test.enough-analyst-54434
12/14/2022, 3:55 PMgray-shoe-19951
12/14/2022, 4:01 PMenough-analyst-54434
12/14/2022, 4:06 PMgray-shoe-19951
12/14/2022, 4:07 PMgray-shoe-19951
12/14/2022, 4:07 PMenough-analyst-54434
12/14/2022, 4:08 PMenough-analyst-54434
12/14/2022, 4:10 PMPATH_NOTEBOOKS / "prep.ipynb"
and report that?enough-analyst-54434
12/14/2022, 4:11 PMgray-shoe-19951
12/14/2022, 4:12 PMgray-shoe-19951
12/14/2022, 4:14 PMenough-analyst-54434
12/14/2022, 4:30 PMenough-analyst-54434
12/14/2022, 4:34 PMenough-analyst-54434
12/14/2022, 4:34 PMgray-shoe-19951
12/14/2022, 4:35 PMenough-analyst-54434
12/14/2022, 4:35 PMgray-shoe-19951
12/16/2022, 6:52 PMenough-analyst-54434
12/16/2022, 6:54 PMgray-shoe-19951
12/16/2022, 6:56 PMenough-analyst-54434
12/16/2022, 6:56 PMgray-shoe-19951
12/16/2022, 6:56 PMenough-analyst-54434
12/16/2022, 7:55 PMenough-analyst-54434
12/16/2022, 7:55 PMgray-shoe-19951
12/16/2022, 7:56 PMenough-analyst-54434
12/16/2022, 7:59 PMPath(__file__).parent / ".." / "notebooks"
is enough for Pants and pytest both. Also, it would be good to hear why you use the pants PEX. Those things are huge and ... generally to be avoided.enough-analyst-54434
12/16/2022, 8:00 PMgray-shoe-19951
12/16/2022, 8:00 PMenough-analyst-54434
12/16/2022, 8:00 PMenough-analyst-54434
12/16/2022, 8:01 PMgray-shoe-19951
12/16/2022, 8:01 PMenough-analyst-54434
12/16/2022, 8:01 PMgray-shoe-19951
12/16/2022, 8:01 PMenough-analyst-54434
12/16/2022, 8:01 PMgray-shoe-19951
12/16/2022, 8:01 PMenough-analyst-54434
12/16/2022, 8:03 PMpants
that goes on your PATH instead of checked into the repo and 1 more per version of Pants you use (it will be a Pex, but targeted per-OS).enough-analyst-54434
12/16/2022, 8:03 PMgray-shoe-19951
12/16/2022, 8:04 PMgray-shoe-19951
12/16/2022, 8:04 PMgray-shoe-19951
12/16/2022, 8:05 PMgray-shoe-19951
12/16/2022, 8:06 PMenough-analyst-54434
12/16/2022, 8:38 PMgray-shoe-19951
12/17/2022, 3:36 AMenough-analyst-54434
12/17/2022, 3:53 AM