Skip to content

Commit 5da381c

Browse files
Functional test fixes for full jupyter runs (microsoft#7976)
1 parent b6545e3 commit 5da381c

File tree

6 files changed

+59
-44
lines changed

6 files changed

+59
-44
lines changed

build/ci/vscode-python-nightly-flake-ci.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ stages:
6363
NeedsPythonFunctionalReqs: true
6464
# This tells the functional tests to not mock out Jupyter...
6565
VSCODE_PYTHON_ROLLING: true
66+
timeoutInMinutes: 180
6667
'Linux-Py3.7 Functional':
6768
PythonVersion: '3.7'
6869
VMImageName: 'ubuntu-16.04'
@@ -84,6 +85,7 @@ stages:
8485
NeedsPythonTestReqs: true
8586
NeedsPythonFunctionalReqs: true
8687
VSCODE_PYTHON_ROLLING: true
88+
timeoutInMinutes: 180
8789
'Linux-Py3.6 Functional':
8890
PythonVersion: '3.6'
8991
VMImageName: 'ubuntu-16.04'
@@ -105,6 +107,7 @@ stages:
105107
NeedsPythonTestReqs: true
106108
NeedsPythonFunctionalReqs: true
107109
VSCODE_PYTHON_ROLLING: true
110+
timeoutInMinutes: 180
108111
'Linux-Py3.5 Functional':
109112
PythonVersion: '3.5'
110113
VMImageName: 'ubuntu-16.04'
@@ -126,6 +129,7 @@ stages:
126129
NeedsPythonTestReqs: true
127130
NeedsPythonFunctionalReqs: true
128131
VSCODE_PYTHON_ROLLING: true
132+
timeoutInMinutes: 180
129133
'Linux-Py2.7 Functional':
130134
PythonVersion: '2.7'
131135
VMImageName: 'ubuntu-16.04'

news/3 Code Health/7877.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix native editor mime type functional test.

news/3 Code Health/7878.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix variable explorer loading test.

src/test/datascience/debugger.functional.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ suite('DataScience Debugger tests', () => {
275275
const resultPromise = getInteractiveCellResults(ioc.wrapper!, 5, async () => {
276276
const breakPromise = createDeferred<void>();
277277
disposables.push(mockDebuggerService!.onBreakpointHit(() => breakPromise.resolve()));
278-
const done = history.debugCode(code, fileName, 0, docManager.activeTextEditor);
278+
const done = history.debugCode(code, '\\Untitled-1', 0, docManager.activeTextEditor);
279279
await waitForPromise(Promise.race([done, breakPromise.promise]), 60000);
280280
assert.ok(breakPromise.resolved, 'Breakpoint event did not fire');
281281
assert.ok(!lastErrorMessage, `Error occurred ${lastErrorMessage}`);

src/test/datascience/nativeEditor.functional.test.tsx

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -123,25 +123,25 @@ suite('DataScience Native Editor', () => {
123123
await createNewEditor(ioc);
124124

125125
const badPanda = `import pandas as pd
126-
df = pd.read("${escapePath(path.join(srcDirectory(), 'DefaultSalesReport.csv'))}")
127-
df.head()`;
126+
df = pd.read("${escapePath(path.join(srcDirectory(), 'DefaultSalesReport.csv'))}")
127+
df.head()`;
128128
const goodPanda = `import pandas as pd
129-
df = pd.read_csv("${escapePath(path.join(srcDirectory(), 'DefaultSalesReport.csv'))}")
130-
df.head()`;
129+
df = pd.read_csv("${escapePath(path.join(srcDirectory(), 'DefaultSalesReport.csv'))}")
130+
df.head()`;
131131
const matPlotLib = 'import matplotlib.pyplot as plt\r\nimport numpy as np\r\nx = np.linspace(0,20,100)\r\nplt.plot(x, np.sin(x))\r\nplt.show()';
132132
const matPlotLibResults = 'img';
133133
const spinningCursor = `import sys
134-
import time
135-
def spinning_cursor():
136-
while True:
137-
for cursor in '|/-\\\\':
138-
yield cursor
139-
spinner = spinning_cursor()
140-
for _ in range(50):
141-
sys.stdout.write(next(spinner))
142-
sys.stdout.flush()
143-
time.sleep(0.1)
144-
sys.stdout.write('\\r')`;
134+
import time
135+
def spinning_cursor():
136+
while True:
137+
for cursor in '|/-\\\\':
138+
yield cursor
139+
spinner = spinning_cursor()
140+
for _ in range(50):
141+
sys.stdout.write(next(spinner))
142+
sys.stdout.flush()
143+
time.sleep(0.1)
144+
sys.stdout.write('\\r')`;
145145

146146
addMockData(ioc, badPanda, `pandas has no attribute 'read'`, 'text/html', 'error');
147147
addMockData(ioc, goodPanda, `<td>A table</td>`, 'text/html');

src/test/datascience/variableexplorer.functional.test.tsx

Lines changed: 37 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ import { InteractivePanel } from '../../datascience-ui/history-react/interactive
1414
import { VariableExplorer } from '../../datascience-ui/interactive-common/variableExplorer';
1515
import { NativeEditor } from '../../datascience-ui/native-editor/nativeEditor';
1616
import { DataScienceIocContainer } from './dataScienceIocContainer';
17-
import { addCode } from './interactiveWindowTestHelpers';
18-
import { addCell, createNewEditor } from './nativeEditorTestHelpers';
17+
import { addCode, runMountedTest as interactiveRunMountedTest } from './interactiveWindowTestHelpers';
18+
import { addCell, createNewEditor, runMountedTest as nativeRunMountedTest } from './nativeEditorTestHelpers';
1919
import { waitForUpdate } from './reactHelpers';
2020
import { runDoubleTest, waitForMessage } from './testHelpers';
2121

@@ -65,6 +65,34 @@ suite('DataScience Interactive Window variable explorer tests', () => {
6565
return waitForMessage(ioc, InteractiveWindowMessages.VariablesComplete);
6666
}
6767

68+
async function checkVariableLoading(wrapper: ReactWrapper<any, Readonly<{}>, React.Component>, targetRenderCount: number) {
69+
const basicCode: string = `value = 'hello world'`;
70+
71+
openVariableExplorer(wrapper);
72+
73+
await addCodeImpartial(wrapper, 'a=1\na');
74+
await addCodeImpartial(wrapper, basicCode, false, 4);
75+
76+
// Target a render count before loading is finished
77+
await waitForUpdate(wrapper, VariableExplorer, targetRenderCount);
78+
79+
let targetVariables: IJupyterVariable[] = [
80+
{name: 'a', value: '1', supportsDataExplorer: false, type: 'int', size: 54, shape: '', count: 0, truncated: false},
81+
{name: 'value', value: 'Loading...', supportsDataExplorer: false, type: 'str', size: 54, shape: '', count: 0, truncated: false}
82+
];
83+
verifyVariables(wrapper, targetVariables);
84+
85+
// Now wait for one more update and then check the variables, we should have loaded the value var
86+
await waitForUpdate(wrapper, VariableExplorer, 1);
87+
88+
targetVariables = [
89+
{name: 'a', value: '1', supportsDataExplorer: false, type: 'int', size: 54, shape: '', count: 0, truncated: false},
90+
// tslint:disable-next-line:quotemark
91+
{name: 'value', value: "'hello world'", supportsDataExplorer: false, type: 'str', size: 54, shape: '', count: 0, truncated: false}
92+
];
93+
verifyVariables(wrapper, targetVariables);
94+
}
95+
6896
async function addCodeImpartial(wrapper: ReactWrapper<any, Readonly<{}>, React.Component>, code: string, waitForVariables: boolean = true, expectedRenderCount: number = 4, expectError: boolean = false): Promise<ReactWrapper<any, Readonly<{}>, React.Component>> {
6997
const variablesUpdated = waitForVariables ? waitForVariablesUpdated() : Promise.resolve();
7098
const nodes = wrapper.find('InteractivePanel');
@@ -153,33 +181,14 @@ value = 'hello world'`;
153181
verifyVariables(wrapper, targetVariables);
154182
}, () => { return ioc; });
155183

156-
runDoubleTest('Variable explorer - Loading', async (wrapper) => {
157-
const basicCode: string = `value = 'hello world'`;
158-
159-
openVariableExplorer(wrapper);
160-
161-
await addCodeImpartial(wrapper, 'a=1\na');
162-
await addCodeImpartial(wrapper, basicCode, false, 4);
163-
164-
// Here we are only going to wait for two renders instead of the needed three
165-
// a should have the value updated, but value should still be loading
166-
await waitForUpdate(wrapper, VariableExplorer, 2);
167-
168-
let targetVariables: IJupyterVariable[] = [
169-
{name: 'a', value: '1', supportsDataExplorer: false, type: 'int', size: 54, shape: '', count: 0, truncated: false},
170-
{name: 'value', value: 'Loading...', supportsDataExplorer: false, type: 'str', size: 54, shape: '', count: 0, truncated: false}
171-
];
172-
verifyVariables(wrapper, targetVariables);
173-
174-
// Now wait for one more update and then check the variables, we should have loaded the value var
175-
await waitForUpdate(wrapper, VariableExplorer, 1);
184+
// For the loading tests we check before the explorer is fully loaded, so split tests here to check
185+
// with different target render counts
186+
nativeRunMountedTest('Variable Explorer - Native Loading', async (wrapper) => {
187+
await checkVariableLoading(wrapper, 3);
188+
}, () => { return ioc; });
176189

177-
targetVariables = [
178-
{name: 'a', value: '1', supportsDataExplorer: false, type: 'int', size: 54, shape: '', count: 0, truncated: false},
179-
// tslint:disable-next-line:quotemark
180-
{name: 'value', value: "'hello world'", supportsDataExplorer: false, type: 'str', size: 54, shape: '', count: 0, truncated: false}
181-
];
182-
verifyVariables(wrapper, targetVariables);
190+
interactiveRunMountedTest('Variable Explorer - Interactive Loading', async (wrapper) => {
191+
await checkVariableLoading(wrapper, 2);
183192
}, () => { return ioc; });
184193

185194
// Test our display of basic types. We render 8 rows by default so only 8 values per test

0 commit comments

Comments
 (0)