Skip to content

Commit

Permalink
Revert "Fix CI (voila-dashboards#1193)"
Browse files Browse the repository at this point in the history
This reverts commit 249b077.
  • Loading branch information
martinRenou committed Sep 30, 2022
1 parent 4c2e782 commit ef5fb21
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 42 deletions.
2 changes: 1 addition & 1 deletion tests/app/preheat_multiple_notebooks_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import os

BASE_DIR = os.path.dirname(__file__)
NOTEBOOK_EXECUTION_TIME = 3
NOTEBOOK_EXECUTION_TIME = 2
NUMBER_PREHEATED_KERNEL = 2
TIME_THRESHOLD = 1

Expand Down
21 changes: 6 additions & 15 deletions tests/execute_output_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ def normalize_output(output):
if 'traceback' in output:
del output['traceback']
if 'application/vnd.jupyter.widget-view+json' in output.get('data', {}):
output['data']['application/vnd.jupyter.widget-view+json'][
'model_id'
] = '<MODEL_ID>'
output['data']['application/vnd.jupyter.widget-view+json']['model_id'] = '<MODEL_ID>'


def normalize_outputs(outputs):
Expand All @@ -36,31 +34,24 @@ def normalize_outputs(outputs):


def test_execute_output():
path = os.path.join(BASE_DIR, 'notebooks/output.ipynb')
path = os.path.join(BASE_DIR, "notebooks/output.ipynb")
nb = read(path, NO_CONVERT)
nb_voila = deepcopy(nb)
executenb(nb_voila)

widget_states = nb.metadata.widgets[WIDGET_MIME_TYPE_STATE]['state']
widget_states_voila = nb_voila.metadata.widgets[WIDGET_MIME_TYPE_STATE][
'state'
]
widget_states_voila = nb_voila.metadata.widgets[WIDGET_MIME_TYPE_STATE]['state']

for cell_voila, cell in zip(nb_voila.cells, nb.cells):
for output_voila, output in zip(cell_voila.outputs, cell.outputs):
if 'data' in output and WIDGET_MIME_TYPE_VIEW in output['data']:
widget_id = output['data'][WIDGET_MIME_TYPE_VIEW]['model_id']
widget_id_voila = output_voila['data'][WIDGET_MIME_TYPE_VIEW][
'model_id'
]
widget_id_voila = output_voila['data'][WIDGET_MIME_TYPE_VIEW]['model_id']
widget_state = widget_states[widget_id]
widget_state_voila = widget_states_voila[widget_id_voila]
# if the widget is an output widget, it has the outputs, which we also check
assert normalize_outputs(
widget_state.state.get('outputs', [])
) == normalize_outputs(
widget_state_voila.state.get('outputs', [])
)
assert normalize_outputs(widget_state.state.get('outputs', [])) ==\
normalize_outputs(widget_state_voila.state.get('outputs', []))
normalize_output(output_voila)
normalize_output(output)
assert output_voila == output
36 changes: 10 additions & 26 deletions tests/notebooks/output.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@
"Output()"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
"output_type": "display_data"
}
],
"source": [
Expand Down Expand Up @@ -73,9 +72,8 @@
"Output()"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
"output_type": "display_data"
}
],
"source": [
Expand Down Expand Up @@ -120,9 +118,8 @@
"Output()"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
"output_type": "display_data"
}
],
"source": [
Expand Down Expand Up @@ -168,9 +165,8 @@
"Output()"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
"output_type": "display_data"
}
],
"source": [
Expand Down Expand Up @@ -215,9 +211,8 @@
"Output()"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
"output_type": "display_data"
}
],
"source": [
Expand Down Expand Up @@ -254,9 +249,8 @@
"Output()"
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
"output_type": "display_data"
}
],
"source": [
Expand All @@ -282,9 +276,8 @@
"Output()"
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
"output_type": "display_data"
}
],
"source": [
Expand All @@ -303,20 +296,11 @@
" print('in outer')\n",
" print('also in inner')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
"language": "python"
},
"language_info": {
"codemirror_mode": {
Expand All @@ -328,7 +312,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.13"
"version": "3.7.3"
},
"widgets": {
"application/vnd.jupyter.widget-state+json": {
Expand Down Expand Up @@ -788,5 +772,5 @@
}
},
"nbformat": 4,
"nbformat_minor": 4
"nbformat_minor": 2
}

0 comments on commit ef5fb21

Please sign in to comment.