Skip to content

Commit ebe8e5a

Browse files
authored
Ensure promises are awaited on (microsoft#3861)
1 parent 6c80bbc commit ebe8e5a

19 files changed

Lines changed: 58 additions & 58 deletions

src/test/common/moduleInstaller.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ suite('Module Installer', () => {
6363
await resetSettings();
6464
});
6565
teardown(async () => {
66-
ioc.dispose();
66+
await ioc.dispose();
6767
await closeActiveWindows();
6868
});
6969

src/test/debugger/envVars.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ suite('Resolving Environment Variables when Debugging', () => {
3333
});
3434
suiteTeardown(closeActiveWindows);
3535
teardown(async () => {
36-
ioc.dispose();
36+
await ioc.dispose();
3737
await closeActiveWindows();
3838
});
3939

src/test/format/extension.format.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ suite('Formatting - General', () => {
8585
await closeActiveWindows();
8686
});
8787
teardown(async () => {
88-
ioc.dispose();
88+
await ioc.dispose();
8989
});
9090

9191
function initializeDI() {

src/test/format/extension.formatOnSave.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ suite('Formating On Save', () => {
3131
await closeActiveWindows();
3232
});
3333
teardown(async () => {
34-
ioc.dispose();
34+
await ioc.dispose();
3535
await closeActiveWindows();
3636
});
3737

src/test/format/extension.sort.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ suite('Sortingx', () => {
4343
sorter = new SortImportsEditingProvider(ioc.serviceContainer);
4444
});
4545
teardown(async () => {
46-
ioc.dispose();
46+
await ioc.dispose();
4747
await closeActiveWindows();
4848
});
4949
function initializeDI() {

src/test/languageServers/jedi/autocomplete/base.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ suite('Autocomplete Base Tests', function () {
4040
suiteTeardown(closeActiveWindows);
4141
teardown(async () => {
4242
await closeActiveWindows();
43-
ioc.dispose();
43+
await ioc.dispose();
4444
});
4545
function initializeDI() {
4646
ioc = new UnitTestIocContainer();
@@ -75,7 +75,7 @@ suite('Autocomplete Base Tests', function () {
7575
textDocument.uri,
7676
position);
7777

78-
const indexOfFstat = list.items.findIndex((val: vscode.CompletionItem) => val.label === 'fstat');
78+
const indexOfFstat = list!.items.findIndex((val: vscode.CompletionItem) => val.label === 'fstat');
7979

8080
assert(
8181
indexOfFstat !== -1,

src/test/languageServers/jedi/autocomplete/pep484.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ suite('Autocomplete PEP 484', () => {
2020
suiteSetup(async function () {
2121
await initialize();
2222
initializeDI();
23-
isPython2 = await ioc.getPythonMajorVersion(rootWorkspaceUri) === 2;
23+
isPython2 = await ioc.getPythonMajorVersion(rootWorkspaceUri!) === 2;
2424
if (isPython2) {
2525
// tslint:disable-next-line:no-invalid-this
2626
this.skip();
@@ -31,7 +31,7 @@ suite('Autocomplete PEP 484', () => {
3131
suiteTeardown(closeActiveWindows);
3232
teardown(async () => {
3333
await closeActiveWindows();
34-
ioc.dispose();
34+
await ioc.dispose();
3535
});
3636
function initializeDI() {
3737
ioc = new UnitTestIocContainer();

src/test/languageServers/jedi/signature/signature.jedi.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ suite('Signatures (Jedi)', () => {
2929
suiteSetup(async () => {
3030
await initialize();
3131
initializeDI();
32-
isPython2 = await ioc.getPythonMajorVersion(rootWorkspaceUri) === 2;
32+
isPython2 = await ioc.getPythonMajorVersion(rootWorkspaceUri!) === 2;
3333
});
3434
setup(initializeTest);
3535
suiteTeardown(closeActiveWindows);
3636
teardown(async () => {
3737
await closeActiveWindows();
38-
ioc.dispose();
38+
await ioc.dispose();
3939
});
4040
function initializeDI() {
4141
ioc = new UnitTestIocContainer();

src/test/linters/lint.multiroot.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ suite('Multiroot Linting', () => {
3232
});
3333
suiteTeardown(closeActiveWindows);
3434
teardown(async () => {
35-
ioc.dispose();
35+
await ioc.dispose();
3636
await closeActiveWindows();
3737
PythonSettings.dispose();
3838
});

src/test/unittests/debugger.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ suite('Unit Tests - debugging', () => {
4949
initializeDI();
5050
});
5151
teardown(async () => {
52-
ioc.dispose();
52+
await ioc.dispose();
5353
await updateSetting('unitTest.unittestArgs', defaultUnitTestArgs, rootWorkspaceUri, configTarget);
5454
await updateSetting('unitTest.nosetestArgs', [], rootWorkspaceUri, configTarget);
5555
await updateSetting('unitTest.pyTestArgs', [], rootWorkspaceUri, configTarget);
@@ -83,7 +83,7 @@ suite('Unit Tests - debugging', () => {
8383
}
8484

8585
async function testStartingDebugger(testProvider: TestProvider) {
86-
const testManager = ioc.serviceContainer.get<ITestManagerFactory>(ITestManagerFactory)(testProvider, rootWorkspaceUri, testFilesPath);
86+
const testManager = ioc.serviceContainer.get<ITestManagerFactory>(ITestManagerFactory)(testProvider, rootWorkspaceUri!, testFilesPath);
8787
const mockDebugLauncher = ioc.serviceContainer.get<MockDebugLauncher>(ITestDebugLauncher);
8888
const tests = await testManager.discoverTests(CommandSource.commandPalette, true, true);
8989
assert.equal(tests.testFiles.length, 2, 'Incorrect number of test files');
@@ -127,7 +127,7 @@ suite('Unit Tests - debugging', () => {
127127
});
128128

129129
async function testStoppingDebugger(testProvider: TestProvider) {
130-
const testManager = ioc.serviceContainer.get<ITestManagerFactory>(ITestManagerFactory)(testProvider, rootWorkspaceUri, testFilesPath);
130+
const testManager = ioc.serviceContainer.get<ITestManagerFactory>(ITestManagerFactory)(testProvider, rootWorkspaceUri!, testFilesPath);
131131
const mockDebugLauncher = ioc.serviceContainer.get<MockDebugLauncher>(ITestDebugLauncher);
132132
const tests = await testManager.discoverTests(CommandSource.commandPalette, true, true);
133133
assert.equal(tests.testFiles.length, 2, 'Incorrect number of test files');
@@ -141,7 +141,7 @@ suite('Unit Tests - debugging', () => {
141141

142142
const discoveryPromise = testManager.discoverTests(CommandSource.commandPalette, true, true, true);
143143
await expect(runningPromise).to.be.rejectedWith(CANCELLATION_REASON, 'Incorrect reason for ending the debugger');
144-
ioc.dispose(); // will cancel test discovery
144+
await ioc.dispose(); // will cancel test discovery
145145
await expect(discoveryPromise).to.be.rejectedWith(CANCELLATION_REASON, 'Incorrect reason for ending the debugger');
146146
}
147147

@@ -161,7 +161,7 @@ suite('Unit Tests - debugging', () => {
161161
});
162162

163163
async function testDebuggerWhenRediscoveringTests(testProvider: TestProvider) {
164-
const testManager = ioc.serviceContainer.get<ITestManagerFactory>(ITestManagerFactory)(testProvider, rootWorkspaceUri, testFilesPath);
164+
const testManager = ioc.serviceContainer.get<ITestManagerFactory>(ITestManagerFactory)(testProvider, rootWorkspaceUri!, testFilesPath);
165165
const mockDebugLauncher = ioc.serviceContainer.get<MockDebugLauncher>(ITestDebugLauncher);
166166
const tests = await testManager.discoverTests(CommandSource.commandPalette, true, true);
167167
assert.equal(tests.testFiles.length, 2, 'Incorrect number of test files');

0 commit comments

Comments
 (0)