Skip to content

Fix ipywidget ci test failures #11025

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/test/datascience/dataScienceIocContainer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -797,9 +797,9 @@ export class DataScienceIocContainer extends UnitTestIocContainer {
instance(packageService)
);

// Disable experiments.
// Enable experiments.
const experimentManager = mock(ExperimentsManager);
when(experimentManager.inExperiment(anything())).thenReturn(false);
when(experimentManager.inExperiment(anything())).thenReturn(true);
when(experimentManager.activate()).thenResolve();
this.serviceManager.addSingletonInstance<IExperimentsManager>(IExperimentsManager, instance(experimentManager));

Expand Down
39 changes: 5 additions & 34 deletions src/test/datascience/uiTests/ipywidget.ui.functional.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ import { addMockData } from '../testHelpersCore';
import { waitTimeForUIToUpdate } from './helpers';
import { openNotebook } from './notebookHelpers';
import { NotebookEditorUI } from './notebookUi';
import { TestRecorder } from './recorder';
import { WebServer } from './webBrowserPanel';

const sanitize = require('sanitize-filename');
// Include default timeout.
Expand All @@ -41,45 +39,18 @@ use(chaiAsPromised);
// These are UI tests, hence nothing to do with platforms.
UseCustomEditor.enabled = useCustomEditorApi;
this.timeout(30_000); // UI Tests, need time to start jupyter.
this.retries(3); // UI Tests can be flaky.
if (!process.env.VSCODE_PYTHON_ROLLING) {
// Skip all tests unless using real jupyter
this.skip();
}
});
let testRecorder: TestRecorder;
setup(async function () {
const testFileName = path.join(
EXTENSION_ROOT_DIR,
`src/test/datascience/uiTests/recordedTests/test_log_${sanitize(this.currentTest?.title)}.log`
);
setup(async () => {
UseCustomEditor.enabled = useCustomEditorApi;
ioc = new DataScienceIocContainer(true);
ioc.registerDataScienceTypes(useCustomEditorApi);

// Use mode = 'replay' for testing with fake jupyter and fake messages (play back recorded messages sent/received from/to UI).
// Use mode = 'record' to record messages to be played back for running tests without real jupyter.
// Use this locally so you can generate the test logs and check in with PR.
// Use mode = 'skip' to run tests without recording or playing (with real jupyter and on CI.)
let mode: 'skip' | 'replay' | 'record' = 'skip';
if (process.env.VSCODE_PYTHON_ROLLING) {
// Definitely running tests on CI/local machine with real jupyter.
mode = 'skip';
} else if (!process.env.VSCODE_PYTHON_ROLLING) {
// Definitely running tests without real jupyter.
// Hence use fake messages.
mode = 'replay';
}
// Hardcode value to `record` to re-generate or generate new test logs.
// mode = 'record';
if (mode === 'replay' && !(await fs.pathExists(testFileName))) {
return this.skip();
}
WebServer.create = () => {
const server = new WebServer();
testRecorder = new TestRecorder(server, mode, testFileName);
return server;
};
await ioc.activate();
});
teardown(async () => {
await testRecorder.end();
sinon.restore();
mockedVSCodeNamespaces.window?.reset();
for (const disposable of disposables) {
Expand Down
2,675 changes: 0 additions & 2,675 deletions src/test/datascience/uiTests/recordedTests/test_log_Checkox Widget.log

This file was deleted.

This file was deleted.

This file was deleted.

4,062 changes: 0 additions & 4,062 deletions src/test/datascience/uiTests/recordedTests/test_log_Render ipysheets.log

This file was deleted.

2,615 changes: 0 additions & 2,615 deletions src/test/datascience/uiTests/recordedTests/test_log_Slider Widget.log

This file was deleted.

2,575 changes: 0 additions & 2,575 deletions src/test/datascience/uiTests/recordedTests/test_log_Text Widget.log

This file was deleted.