Skip to content

Commit

Permalink
ignore deprecation message causing exception (#15079)
Browse files Browse the repository at this point in the history
* ignore deprecation message causing exception

* fix unit tests

* more deprecation warning failures

* do not fail for std err output
  • Loading branch information
amunger authored Jan 26, 2024
1 parent ce5cf64 commit d3a68fc
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ suite('DataViewer @webview', function () {
await vscode.commands.executeCommand('workbench.debug.viewlet.action.removeAllBreakpoints');
});
// Start debugging using the python extension
test.skip('Open from Python debug variables', async () => {
test('Open from Python debug variables', async () => {
// First off, open up our python test file and make sure editor and groups are how we want them
const textDocument = await openFile(testPythonFile);

Expand Down
11 changes: 7 additions & 4 deletions src/test/datascience/plotViewer/plotViewer.vscode.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,17 @@ suite('VSCode Notebook PlotViewer integration - VSCode Notebook @webview', funct
await insertCodeCell(
`import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
x = np.linspace(0, 20, 100)
import matplotlib.pyplot as plt`,
{ index: 1 }
);
await insertCodeCell(
`x = np.linspace(0, 20, 100)
plt.plot(x, np.sin(x))
plt.show()`,
{ index: 0 }
{ index: 1 }
);

const plotCell = window.activeNotebookEditor?.notebook.cellAt(0)!;
const plotCell = window.activeNotebookEditor?.notebook.cellAt(1)!;

await runAllCellsInActiveNotebook();
await waitForExecutionCompletedSuccessfully(plotCell);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ mySet = {1, 2, 3}
});

// Test opening data viewers while another dataviewer is open
test.skip('Open dataviewer', async function () {
test('Open dataviewer', async function () {
// Send the command to open the view
await commands.executeCommand(Commands.OpenVariableView);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { pandasMinimumVersionSupportedByVariableViewer } from '../../../webviews
import { PythonExecutionFactory } from '../../../platform/interpreter/pythonExecutionFactory.node';
import { IPythonExecutionFactory, IPythonExecutionService } from '../../../platform/interpreter/types.node';
import { mockedVSCodeNamespaces, resetVSCodeMocks } from '../../../test/vscode-mock';
import { interpreterGetPandasVersion } from './interpreterDataViewerDependencyImplementation.node';

suite('DataViewerDependencyService (PythonEnvironment, Node)', () => {
let dependencyService: DataViewerDependencyService;
Expand Down Expand Up @@ -56,27 +57,15 @@ suite('DataViewerDependencyService (PythonEnvironment, Node)', () => {
});
teardown(() => resetVSCodeMocks());
test('All ok, if pandas is installed and version is > 1.20', async () => {
when(
pythonExecService.exec(
deepEqual([
'-c',
'import pandas;print(pandas.__version__);print("5dc3a68c-e34e-4080-9c3e-2a532b2ccb4d")'
]),
anything()
)
).thenResolve({ stdout: '0.30.0\n5dc3a68c-e34e-4080-9c3e-2a532b2ccb4d' });
when(pythonExecService.exec(deepEqual(['-c', interpreterGetPandasVersion]), anything())).thenResolve({
stdout: '0.30.0\n5dc3a68c-e34e-4080-9c3e-2a532b2ccb4d'
});
await dependencyService.checkAndInstallMissingDependencies(interpreter);
});
test('Throw exception if pandas is installed and version is = 0.20', async () => {
when(
pythonExecService.exec(
deepEqual([
'-c',
'import pandas;print(pandas.__version__);print("5dc3a68c-e34e-4080-9c3e-2a532b2ccb4d")'
]),
anything()
)
).thenResolve({ stdout: '0.20.0\n5dc3a68c-e34e-4080-9c3e-2a532b2ccb4d' });
when(pythonExecService.exec(deepEqual(['-c', interpreterGetPandasVersion]), anything())).thenResolve({
stdout: '0.20.0\n5dc3a68c-e34e-4080-9c3e-2a532b2ccb4d'
});

const promise = dependencyService.checkAndInstallMissingDependencies(interpreter);

Expand All @@ -86,15 +75,9 @@ suite('DataViewerDependencyService (PythonEnvironment, Node)', () => {
);
});
test('Throw exception if pandas is installed and version is < 0.20', async () => {
when(
pythonExecService.exec(
deepEqual([
'-c',
'import pandas;print(pandas.__version__);print("5dc3a68c-e34e-4080-9c3e-2a532b2ccb4d")'
]),
anything()
)
).thenResolve({ stdout: '0.10.0\n5dc3a68c-e34e-4080-9c3e-2a532b2ccb4d' });
when(pythonExecService.exec(deepEqual(['-c', interpreterGetPandasVersion]), anything())).thenResolve({
stdout: '0.10.0\n5dc3a68c-e34e-4080-9c3e-2a532b2ccb4d'
});

const promise = dependencyService.checkAndInstallMissingDependencies(interpreter);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { DataScience } from '../../../platform/common/utils/localize';
import { splitLines } from '../../../platform/common/helpers';

const separator = '5dc3a68c-e34e-4080-9c3e-2a532b2ccb4d';
export const kernelGetPandasVersion = `import pandas;print(pandas.__version__);print("${separator}")`;
export const interpreterGetPandasVersion = `import pandas;print(pandas.__version__);print("${separator}")`;

/**
* Uses the Python interpreter to manage dependencies of a Data Viewer.
Expand All @@ -36,8 +36,7 @@ export class InterpreterDataViewerDependencyImplementation extends BaseDataViewe
resource: undefined,
interpreter
});
const result = await launcher.exec(['-c', kernelGetPandasVersion], {
throwOnStdErr: true,
const result = await launcher.exec(['-c', interpreterGetPandasVersion], {
token
});
const output = result.stdout;
Expand Down

0 comments on commit d3a68fc

Please sign in to comment.