File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6,7 +6,6 @@ import { TestConfigurationManager } from './common/testConfigurationManager';
66import * as nose from './nosetest/testConfigurationManager' ;
77import * as pytest from './pytest/testConfigurationManager' ;
88import * as unittest from './unittest/testConfigurationManager' ;
9- import { createDeferred } from '../common/helpers' ;
109
1110const 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}
7785export function displayTestFrameworkError ( ) : Thenable < any > {
You can’t perform that action at this time.
0 commit comments