- OS: XXX (Windows, macOS, latest Ubuntu LTS)
- Shell: XXX (Command Prompt, PowerShell, bash, fish)
- Python
- Distribution: XXX (CPython, miniconda)
- Version: XXX (2.7, latest 3.x)
- VS Code: XXX (Insiders)
- Python Extension: XXX (Insiders)
- Local/Remote: XXX (Local, Remote-SSH, Remote-WSL, Remote-Docker, Remote-Codespaces)
ALWAYS:
- Check the
Output
window underPython
for logged errors - Check the
Output
window underJupyter
for logged errors - Have
Developer Tools
open to detect any errors - Consider running the tests in a multi-folder workspace
- Focus on in-development features (i.e. native notebooks, gather)
- Start and connect to local Jupyter server
- Open the file src/test/datascience/manualTestFiles/manualTestFile.py in VSCode
- At the top of the file it will list the things that you need installed in your Python environment
- Please note, when installing PyTorch please visit pytorch.org to determine how to install
torch
for your environment. Do not runpip install torch
as that will not suffice.
- Please note, when installing PyTorch please visit pytorch.org to determine how to install
- On the first cell click
Run Below
- Interactive Window should open, show connection information, and execute cells
- Verify basic outputs
- Run all the cells in manualTestFile.py
- Check to make sure that no outputs have errors
- Verify that graphs and progress bars are shown
- Verify export / import
- With the results from
Start and connect to local server
open click theSave
button in the Interactive Window - Choose a file location and save the generated .ipynb file
- When the prompt comes up in the lower right choose to open the file in the ipynb editor.
- The file should open in the Notebook Editor.
- With the results from
- Verify text entry
- In the Interactive Window type in some new code
print('testing')
and submit it to the Interactive Windows - Verify the output from what you added
- In the Interactive Window type in some new code
- Verify dark and light main themes
- Repeat the
Start and connect to local server
andVerify basic outputs
steps usingDefault Dark+
andDefault Light+
themes
- Repeat the
- Verify Variable Explorer
- After manualTestFile.py has been run click the Variables button at the top of the Interactive Window
- In the Variables list there should be an entry for all variables created. These variables might change as more is added to manualTestFile.py.
- Check that variables have expected values. They will be truncated for longer items
- Sort the list ascending and descending by Type. Also sort the list ascending and descending by Count. Values like (X, Y) use the first X value for Count sort ordering
- Check that list, Series, ndarray, DataFrame and Tensor types have a button to "Show variable in data viewer" on the right
- In the Interactive Window input box add a new variable. Verify that it is added into the Variable Explorer
- Save the contents of the interactive window as a notebook and open the notebook editor
- Find the first cell and click on the Run Below button
- Open the variable explorer and verify the same variables are there
- Add a new cell with a variable in it.
- Run the cell and verify the variable shows up in the variable explorer
- Verify Data Explorer
- From the listed types in the Variable explorer open up the Data Viewer by clicking the button or double clicking the row
- Inspect the data in the Data Viewer for the expected values
[ ] Verify Sorting and Filtering
- Open up the myDataFrame item
- Sort the name column ascending and descending
- Sort one of the numerical columns ascending and descending
- In the name filter box input 'a' to filter to just name with an a in them
- In one of the numerical columns input a number 1 - 9 to filter to just that column
- In the 'b' filter box input '> -inf'. Verify that this filters to show just the rows with 1 and 4 in the 'b' column.
- In the 'c' filter box input '= NaN'. Verify that this filters to show just the row with 'nan' in the 'c' column.
- In the 'd' filter box input '<= inf'. Verify that this shows all rows.
- In the 'd' filter box input '== inf'. Verify that this just the row with 'inf' in the 'd' column.
- Open the myList variable in the explorer
- Make sure that you can scroll all the way to the end of the entries
- Verify debugging
- Open the file src/test/datascience/manualTestFiles/manualTestFile.py in VSCode
- On the first cell click
Run Below
- Interactive Window should open, show connection information, and execute cells
- Go back to the first cell and click
Debug Cell
- Debugger should start and have an ip indicator on the first line of the cell
- Step through the debugger.
- Verify the variables tab of the debugger shows variables.
- When you get to the end of the cell, the debugger should stop
- Output from the cell should show up in the Interactive Window (sometimes you have to finish debugging the cell first)
- Open notebook and run cells
- Create a brand new folder on your machine.
- Create a new venv in that folder via command line / terminal
python3 -m venv .newEnv
. - Open VS Code with that folder selected as the current workspace.
- Open command palette with Ctrl+Shift+P and select 'Jupyter: Create New Blank Notebook'. Notebook UI should open. Verify there is a single cell in the notebook. The cell language (bottom right corner of the notebook cell) should be Python. The cell toolbar should be on the left.
- Click on the kernel picker in the top right corner and select
.newEnv
from the quickpick that appears. - Add the following code to the empty notebook cell.
import sys print(sys.executable)
- Click the run button on the cell. You should be prompted to install ipykernel in
.newEnv
. Click the 'Install' button on the prompt to install ipykernel. - After ipykernel is installed the cell should execute successfully and display the current Python interpreter path in the cell output.
- Verify that the Python interpreter path in the cell output matches the selected Python environment in the kernel picker.
- Click on the kernel picker in the top right corner and select a different Python environment.
- Rerun the first cell and verify that the path in the cell output matches the selected Python environment in the kernel picker.
- Verify notebook editor IntelliSense
- Open the src/test/datascience/manualTestFiles/manualTestFile.py in VSCode.
- Run all of the cells in the file.
- Interactive Window should open
- Export the cells in the interactive window and open the notebook editor
- Hover over each cell in the notebook editor and verify you get hover intellisense
- Add a new cell in between cells
- Add
import sys
andsys.executable
to the cell - Move the cell around and verify intellisense hover still works on the
import sys
- Delete and readd the cell and verify intellisense hover still works.
- Verify Notebook Keyboard Shortcuts
- Select a notebook cell by clicking on it
- Move selection up and down with
j
,k
and arrow keys. - Focus a cell by double clicking on it or hitting the enter key when selected
- Move selection through the code with the arrow keys.
- Verify selection travels between focused cells
- Hit escape when a cell has focus and verify it becomes selected instead of focused
- Hit
y
on a markdown cell when not focused and see that it becomes a code cell - Hit
m
on a code cell when not focused and see that it becomes a markdown cell - Hit
l
on a code cell and verify line numbers appear - Hit
o
on a code cell with output and verify that outputs disappear - Hit
d
+d
and verify a cell is deleted. - Hit
z
and verify a deleted cell reappears - Hit
a
and verify the selected cell moves up - Hit
b
and verify the selected cell moves down - Hit
shift+enter
and verify a cell runs and selection moves to the next cell - Hit
alt+enter
and verify a cell runs and a new cell is added below - Hit
ctrl+enter
and verify a cell runs and selection does not change
- Verify notebook outputs
- Open the src/test/datascience/manualTestFiles/manualTestFile.py in VSCode.
- Run all of the cells in the file.
- Interactive window should open
- Export the cells in the interactive window and open the notebook editor
- Run all the cells in the notebook editor and verify the same outputs appear as in the interactive window
-
Connect to a
remote
server- Open up a valid python command prompt that can run
jupyter notebook
(a default Anaconda prompt works well) - Run
jupyter notebook
to start up a local Jupyter server - In the command window that launched Jupyter look for the server / token name like so: http://localhost:8888/?token=bf9eae43641cd75015df9104f814b8763ef0e23ffc73720d
- Run the command
Python: Select Jupyter server URI
thenType in the URI to connect to a running jupyter server
- Input the server / token name here
- Now run the cells in the manualTestFile.py
- Verify the outputs of the cells
- Open up a valid python command prompt that can run
-
Interactive Window commands
- Verify per-cell commands
- Expand and collapse the input area of a cell
- Use the
X
button to remove a cell - Use the
Goto Code
button to jump to the part of the .py file that submitted the code
- Verify top menu commands
- Use
X
to delete all cells - Undo the delete action with
Undo
- Redo the delete action with
Redo
- In manualTestFile.py modify the trange command in the progress bar from 100 to 2000. Run the Cell. As the cell is running hit the
Interrupt Jupyter Kernel
button - The progress bar should be interrupted and you should see a KeyboardInterrupt error message in the output
- Test the
Restart Jupyter kernel
command. Kernel should be restarted and you should see a status output message for the kernel restart - Use the expand all input and collapse all input commands to collapse all cell inputs
- Use
- Verify per-cell commands
-
Verify theming works
- Start Interactive window
- Add a cell with some comments
- Switch VS Code theme to something else
- Check that the cell you just added updates the comment color
- Switch back and forth between a 'light' and a 'dark' theme
- Check that the cell switches colors
- Check that the buttons on the top change to their appropriate 'light' or 'dark' versions
- Enable the 'ignoreVscodeTheme' setting
- Close the Interactive window and reopen it. The theme in just the 'Interactive' window should be light
- Switch to a dark theme. Make sure the interactive window remains in the light theme.
-
Verify code lenses
- Check that
Run Cell
Run Above
andRun Below
all do the correct thing
- Check that
-
Verify context menu navigation commands
- Check the
Run Current Cell
andRun Current Cell And Advance
context menu commands - If run on the last cell of the file
Run Current Cell And Advance
should create a new empty cell and advance to it
- Check the
-
Verify command palette commands
- Close the Interactive Window then pick
Python: Show Interactive Window
- Restart the kernel and pick
Python: Run Current File In Interactive Window
it should run the whole file again
- Close the Interactive Window then pick
-
Verify shift-enter
- Move to the top cell in the .py file
- Shift-enter should run each cell and advance to the next
- Shift-enter on the final cell should create a new cell and move to it
-
Verify file without cells
- Open the manualTestFileNoCells.py file
- Select a chunk of code, shift-enter should send it to the terminal
- Open VSCode settings, change
Send Selection To Interactive Window
to true - Select a chunk of code, shift-enter should send that selection to the Interactive Windows
- Move your cursor to a line, but don't select anything. Shift-enter should send that line to the Interactive Window
-
Jupyter Hub support
-
Windows install instructions
- Install Docker Desktop onto a machine
- Create a folder with a file 'Dockerfile' in it.
- Mark the file to look like so:
ARG BASE_CONTAINER=jupyterhub/jupyterhub FROM $BASE_CONTAINER USER root USER $NB_UID
- From a command prompt (in the same folder as the Dockerfile), run
docker build -t jupyterhubcontainer:1.0 .
- Run
docker container create --name jupyterhub jupyterhubcontainer:1.0 jupyterhub
- From the docker desktop app, start the jupyterhub container.
- From the docker desktop app, run the CLI
-
OR Mac / Linux install instructions
- Install docker
- From the terminal
docker run -p 8000:8000 -d --name jupyterhub jupyterhub/jupyterhub jupyterhub
- Open a terminal in the docker container with
docker exec -it jupyterhub bash
- From that terminal run
python3 -m pip install notebook
-
From the new command prompt, run
adduser testuser
-
Follow the series of prompts to add a password for this user
-
Open VS code
-
Open a folder with a python file in it.
-
Run the
Python: Specify local or remote Jupyter server for connections
command. -
Pick 'Existing'
-
Enter
http://localhost:8000
(assuming the jupyter hub container was successful in launching) -
Reload VS code and reopen this folder.
-
Run a cell in a python file. [ ] Verify results 1. Verify you are asked first for a user name and then a password. 1. Verify a cell runs once you enter the user name and password 1. Verify that the python that is running in the interactive window is from the docker container (if on windows it should show a linux path)
-
-
Verify ability to open data viewer from debugger
- Open the file src/test/datascience/manualTestFiles/manualTestFileDebugger.py in VS Code
- Set a breakpoint on the last line
- Open the debug panel in the left sidebar of VS Code and run 'Python: Current File' debug configuration
- All the variables defined in the file should appear in the debug variables window in the sidebar
- Right click on each of the following variables and select the 'View Variable in Data Viewer' option from the context menu: myNparray, myDataFrame, mySeries, myList, myString, myTensor. Verify that the data viewer opens and displays them
- Expand the tree view for the variable
x
. Right click on its instance memberb
and select 'View Variable in Data Viewer' from the context menu. Verify that this opensx.b
and notb
in the data viewer.
-
Run by line
- Open a new blank Jupyter notebook.
- Add the following code to a cell:
def bar(): for i in range(5): print(i) def foo(): bar() foo() print('Done')
- Press F10 to step through the code in the cell line-by-line. Verify that it first steps over function definitions for
foo()
andbar()
, then steps into the function definitions afterfoo()
is called, then steps back out when the loop inbar()
finishes and prints 'Done'.
- Directory change
- Verify directory change in export
- Follow the previous steps for export, but export the ipynb to a directory outside of the current workspace
- Open the file in the browser, you should get an initial cell added to change directory back to your workspace directory
- Verify directory change in import
- Follow the previous steps for import, but import an ipynb that is located outside of your current workspace
- Open the file in the editor. There should be python code at the start to change directory to the previous location of the .ipynb file
- Verify directory change in export
- Interactive Window input history history
- Start up an Interactive Window session
- Input several lines into the Interactive Window terminal
- Press up to verify that those previously entered lines show in the Interactive Window terminal history
- Extra themes 1. Try several of the themes that come with VSCode that are not the default Dark+ and Light+