Skip to content

Commit f5a8ab8

Browse files
committed
unittest - enable after configuring the tests
1 parent 2a02301 commit f5a8ab8

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

‎src/client/unittests/configuration.ts‎

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import { TestConfigurationManager } from './common/testConfigurationManager';
66
import * as nose from './nosetest/testConfigurationManager';
77
import * as pytest from './pytest/testConfigurationManager';
88
import * as unittest from './unittest/testConfigurationManager';
9-
import { createDeferred } from '../common/helpers';
109

1110
const settings = PythonSettings.getInstance();
1211

@@ -57,8 +56,8 @@ function promptToEnableAndConfigureTestFramework(messageToDisplay: string = 'Sel
5756
}
5857
}
5958

60-
configMgr.enable();
6159
if (enableOnly) {
60+
configMgr.enable();
6261
// Ensure others are disabled
6362
if (item.product !== Product.unittest) {
6463
(new unittest.ConfigurationManager()).disable();
@@ -71,7 +70,16 @@ function promptToEnableAndConfigureTestFramework(messageToDisplay: string = 'Sel
7170
}
7271
return Promise.resolve();
7372
}
74-
return configMgr.configure(vscode.workspace.rootPath);
73+
74+
// Configure everything before enabling
75+
// Cuz we don't want the test engine (in main.ts file - tests get discovered when config changes are detected)
76+
// to start discovering tests when tests haven't been configured properly
77+
return configMgr.configure(vscode.workspace.rootPath).then(() => {
78+
configMgr.enable();
79+
}).catch(reason => {
80+
configMgr.enable();
81+
return Promise.reject(reason);
82+
});
7583
});
7684
}
7785
export function displayTestFrameworkError(): Thenable<any> {

0 commit comments

Comments
 (0)