forked from DonJayamanne/pythonVSCode
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve the perf of functional tests running with real jupyter (#10242)
* Improve the perf of subsequent tests by caching interpreters * Add back the nightly flake * Remove coverage * Add news entry * Use a static map to allow promise to be cleared on new interpreters (as it was before)
- Loading branch information
Showing
7 changed files
with
255 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
./out/test/**/*.functional.test.js | ||
--require=out/test/unittests.js | ||
--exclude=out/**/*.jsx | ||
--ui=tdd | ||
--recursive | ||
--colors | ||
--exit | ||
--timeout=180000 | ||
--reporter spec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
# Nightly build | ||
|
||
name: '$(Year:yyyy).$(Month).0.$(BuildID)-nightly-flake' | ||
|
||
# Not the CI build, see `vscode-python-nightly-flake-ci.yaml`. | ||
trigger: none | ||
|
||
# Not the PR build for merges to master and release. | ||
pr: none | ||
|
||
schedules: | ||
- cron: "0 8 * * 1-5" | ||
# Daily midnight PST build, runs Monday - Friday always | ||
displayName: Nightly Flake build | ||
branches: | ||
include: | ||
- master | ||
- release* | ||
always: true | ||
|
||
# Variables that are available for the entire pipeline. | ||
variables: | ||
- template: templates/globals.yml | ||
|
||
stages: | ||
- stage: Build | ||
jobs: | ||
- template: templates/jobs/build_compile.yml | ||
|
||
# Each item in each matrix has a number of possible values it may | ||
# define. They are detailed in templates/test_phases.yml. The only | ||
# required value is "TestsToRun". | ||
|
||
- stage: Linux | ||
dependsOn: | ||
- Build | ||
jobs: | ||
- job: 'Py3x' | ||
dependsOn: [] | ||
timeoutInMinutes: 120 | ||
strategy: | ||
matrix: | ||
'Functional': | ||
TestsToRun: 'testfunctional' | ||
NeedsPythonTestReqs: true | ||
NeedsPythonFunctionalReqs: true | ||
VSCODE_PYTHON_ROLLING: true | ||
pool: | ||
vmImage: 'ubuntu-16.04' | ||
steps: | ||
- template: templates/test_phases.yml | ||
|
||
- job: 'Py36' | ||
dependsOn: [] | ||
timeoutInMinutes: 120 | ||
strategy: | ||
matrix: | ||
'Functional': | ||
PythonVersion: '3.6' | ||
TestsToRun: 'testfunctional' | ||
NeedsPythonTestReqs: true | ||
NeedsPythonFunctionalReqs: true | ||
VSCODE_PYTHON_ROLLING: true | ||
pool: | ||
vmImage: 'ubuntu-16.04' | ||
steps: | ||
- template: templates/test_phases.yml | ||
|
||
- stage: Mac | ||
dependsOn: | ||
- Build | ||
jobs: | ||
- job: 'Py3x' | ||
dependsOn: [] | ||
timeoutInMinutes: 120 | ||
strategy: | ||
matrix: | ||
'Functional': | ||
TestsToRun: 'testfunctional' | ||
NeedsPythonTestReqs: true | ||
NeedsPythonFunctionalReqs: true | ||
VSCODE_PYTHON_ROLLING: true | ||
pool: | ||
vmImage: 'macos-10.13' | ||
steps: | ||
- template: templates/test_phases.yml | ||
|
||
- job: 'Py36' | ||
dependsOn: [] | ||
timeoutInMinutes: 120 | ||
strategy: | ||
matrix: | ||
'Functional': | ||
PythonVersion: '3.6' | ||
TestsToRun: 'testfunctional' | ||
NeedsPythonTestReqs: true | ||
NeedsPythonFunctionalReqs: true | ||
VSCODE_PYTHON_ROLLING: true | ||
pool: | ||
vmImage: 'macos-10.13' | ||
steps: | ||
- template: templates/test_phases.yml | ||
|
||
- stage: Windows | ||
dependsOn: | ||
- Build | ||
jobs: | ||
- job: 'Py3x' | ||
dependsOn: [] | ||
timeoutInMinutes: 120 | ||
strategy: | ||
matrix: | ||
'Functional': | ||
TestsToRun: 'testfunctional' | ||
NeedsPythonTestReqs: true | ||
NeedsPythonFunctionalReqs: true | ||
VSCODE_PYTHON_ROLLING: true | ||
pool: | ||
vmImage: 'vs2017-win2016' | ||
steps: | ||
- template: templates/test_phases.yml | ||
|
||
- job: 'Py36' | ||
dependsOn: [] | ||
timeoutInMinutes: 120 | ||
strategy: | ||
matrix: | ||
'Functional': | ||
PythonVersion: '3.6' | ||
TestsToRun: 'testfunctional' | ||
NeedsPythonTestReqs: true | ||
NeedsPythonFunctionalReqs: true | ||
VSCODE_PYTHON_ROLLING: true | ||
pool: | ||
vmImage: 'vs2017-win2016' | ||
steps: | ||
- template: templates/test_phases.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Functional tests using real jupyter can take 30-90 seconds each. Most of this time is searching for interpreters. Cache the interpreter search. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { Memento } from 'vscode'; | ||
import { PersistentStateFactory } from '../../client/common/persistentState'; | ||
import { IPersistentState, IPersistentStateFactory } from '../../client/common/types'; | ||
|
||
const PrefixesToStore = ['INTERPRETERS_CACHE']; | ||
|
||
// tslint:disable-next-line: no-any | ||
const persistedState = new Map<string, any>(); | ||
|
||
class TestPersistentState<T> implements IPersistentState<T> { | ||
constructor(private key: string, defaultValue?: T | undefined) { | ||
if (defaultValue) { | ||
persistedState.set(key, defaultValue); | ||
} | ||
} | ||
public get value(): T { | ||
return persistedState.get(this.key); | ||
} | ||
public async updateValue(value: T): Promise<void> { | ||
persistedState.set(this.key, value); | ||
} | ||
} | ||
|
||
// This class is used to make certain values persist across tests. | ||
export class TestPersistentStateFactory implements IPersistentStateFactory { | ||
private realStateFactory: PersistentStateFactory; | ||
constructor(globalState: Memento, localState: Memento) { | ||
this.realStateFactory = new PersistentStateFactory(globalState, localState); | ||
} | ||
|
||
public createGlobalPersistentState<T>( | ||
key: string, | ||
defaultValue?: T | undefined, | ||
expiryDurationMs?: number | undefined | ||
): IPersistentState<T> { | ||
if (PrefixesToStore.find(p => key.startsWith(p))) { | ||
return new TestPersistentState(key, defaultValue); | ||
} | ||
|
||
return this.realStateFactory.createGlobalPersistentState(key, defaultValue, expiryDurationMs); | ||
} | ||
public createWorkspacePersistentState<T>( | ||
key: string, | ||
defaultValue?: T | undefined, | ||
expiryDurationMs?: number | undefined | ||
): IPersistentState<T> { | ||
if (PrefixesToStore.find(p => key.startsWith(p))) { | ||
return new TestPersistentState(key, defaultValue); | ||
} | ||
|
||
return this.realStateFactory.createWorkspacePersistentState(key, defaultValue, expiryDurationMs); | ||
} | ||
} |