Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add an option to show the cell outputs per second (#116)
Co-authored-by: krassowski <5832902+krassowski@users.noreply.github.com>
- Loading branch information
1 parent
9c56a05
commit 7ebb8dc
Showing
6 changed files
with
121 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"id": "98ce2d4e-e422-40ea-aa89-5adabbb8d0f0", | ||
"metadata": {}, | ||
"source": [ | ||
"Notes:\n", | ||
"- Each cells is self-contained to allow parallel testing.\n", | ||
"- Cell indices are used in tests." | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "f28cb5ea-94a4-47d3-9860-4cf20a29d690", | ||
"metadata": {}, | ||
"source": [ | ||
"#### Last executed at with outputs:" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "3cfa2867-8f80-4793-9a4d-d773b06136e1", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"for i in range(5):\n", | ||
" display(1)\n", | ||
" sleep(0.01)" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3 (ipykernel)", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.11.9" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { expect, galata, test } from '@jupyterlab/galata'; | ||
import { openNotebook, cleanup, maskedScreenshot } from './utils'; | ||
|
||
const SETTINGS_ID = 'jupyterlab-execute-time:settings'; | ||
|
||
test.describe('Timing outcomes with ', () => { | ||
test.beforeEach(openNotebook('Timing_outputs_outcomes.ipynb')); | ||
test.afterEach(cleanup); | ||
// Disable flashing highlight for screenshot consistency | ||
test.use({ | ||
mockSettings: { | ||
...galata.DEFAULT_SETTINGS, | ||
[SETTINGS_ID]: { | ||
...galata.DEFAULT_SETTINGS[SETTINGS_ID], | ||
highlight: false, | ||
showOutputsPerSecond: true, | ||
}, | ||
}, | ||
}); | ||
|
||
test('"Last executed at" state', async ({ page }) => { | ||
const cell = await page.notebook.getCell(2); | ||
|
||
// Execute cell and wait for it to complete | ||
await page.notebook.runCell(2); | ||
|
||
const widget = await cell.waitForSelector('.execute-time'); | ||
expect(await widget.textContent()).toContain('Last executed at'); | ||
expect(await widget.textContent()).toContain('outputs at'); | ||
expect(await maskedScreenshot(widget)).toMatchSnapshot( | ||
'last-executed-outputs.png' | ||
); | ||
}); | ||
}); |
Binary file added
BIN
+3.55 KB
...tests/timing_outputs_outcomes.spec.ts-snapshots/last-executed-outputs-linux.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.