Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.10.0 release captures output even when ';' is present #194

Open
pgbarletta opened this issue Jan 13, 2023 · 3 comments
Open

0.10.0 release captures output even when ';' is present #194

pgbarletta opened this issue Jan 13, 2023 · 3 comments

Comments

@pgbarletta
Copy link
Contributor

Hi,

I'd frequently add a semicolon to silence a notebook's output instead of sanitizing it, when I didn't care about the output but I did care about the cell actually running.
The new release seems to get the cell output, even when the semicolon is present, so when it compares that output against the saved cell, it finds a discrepancy:

Traceback:
Unexpected output fields from running code: {'text/plain'}

was this intended? I'm currently removing all the semicolons from my notebooks and sanitizing the outputs so the tests work again, but I thought this was an unexpected behaviour, so I wanted to ask.

Cheers,

@takluyver
Copy link
Member

I don't think that was intended. I see there's also now a PR adding a failing test (#195).

I'm a bit puzzled, though, because I thought this was up to the kernel - I thought nbval wouldn't receive an execute_result message, so it didn't need to do anything special to handle this.

@kandersolar
Copy link
Contributor

I think 525a14f is the relevant change. I'm not familiar enough with the jupyter ecosystem to know what's going on under the hood here, but commenting out the new store_history=False line gets the test case in #195 passing for me locally.

@takluyver
Copy link
Member

Thanks for the detective work! That vaguely makes sense - IPython's Out[n] execution results are part of the history. But I don't see a good reason why telling it not to store input history would override hiding output.

I think this is a bug in IPython. Specifically, the code deciding whether to display output uses the latest history entry, and if that's not the cell currently executing, it can get this wrong (presumably in either direction). See here:

https://github.com/ipython/ipython/blob/855e4595b72d85679027ce253e687c20bbc24e84/IPython/core/displayhook.py#L84-L92

I don't think this has been reported yet, but I've only done a very superficial search for it. If someone else could check it and do a bug report, that would be valuable.

uellue added a commit to uellue/LiberTEM that referenced this issue Feb 9, 2023
Many of the results are random since the test data generated by the
notebook is random.

Also include mitigation for
computationalmodelling/nbval#194
uellue added a commit to uellue/LiberTEM that referenced this issue Mar 17, 2023
Many of the results are random since the test data generated by the
notebook is random.

Also include mitigation for
computationalmodelling/nbval#194
sk1p pushed a commit to LiberTEM/LiberTEM that referenced this issue Mar 20, 2023
Many of the results are random since the test data generated by the
notebook is random.

Also include mitigation for
computationalmodelling/nbval#194
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants