@@ -12,13 +12,11 @@ import {
12
12
IPythonExecutionFactory ,
13
13
SpawnOptions ,
14
14
} from '../../../common/process/types' ;
15
+ import { EXTENSION_ROOT_DIR } from '../../../constants' ;
15
16
import { removePositionalFoldersAndFiles } from './arguments' ;
16
- import { ITestDebugLauncher , LaunchOptions } from '../../common/types' ;
17
- import { PYTEST_PROVIDER } from '../../common/constants' ;
18
- import { EXTENSION_ROOT_DIR } from '../../../common/constants' ;
19
17
20
18
// eslint-disable-next-line @typescript-eslint/no-explicit-any
21
- // (global as any).EXTENSION_ROOT_DIR = EXTENSION_ROOT_DIR;
19
+ ( global as any ) . EXTENSION_ROOT_DIR = EXTENSION_ROOT_DIR ;
22
20
/**
23
21
* Wrapper Class for pytest test execution. This is where we call `runTestCommand`?
24
22
*/
@@ -49,12 +47,11 @@ export class PytestTestExecutionAdapter implements ITestExecutionAdapter {
49
47
testIds : string [ ] ,
50
48
debugBool ?: boolean ,
51
49
executionFactory ?: IPythonExecutionFactory ,
52
- debugLauncher ?: ITestDebugLauncher ,
53
50
) : Promise < ExecutionTestPayload > {
54
51
traceVerbose ( uri , testIds , debugBool ) ;
55
52
if ( executionFactory !== undefined ) {
56
53
// ** new version of run tests.
57
- return this . runTestsNew ( uri , testIds , debugBool , executionFactory , debugLauncher ) ;
54
+ return this . runTestsNew ( uri , testIds , debugBool , executionFactory ) ;
58
55
}
59
56
// if executionFactory is undefined, we are using the old method signature of run tests.
60
57
this . outputChannel . appendLine ( 'Running tests.' ) ;
@@ -67,7 +64,6 @@ export class PytestTestExecutionAdapter implements ITestExecutionAdapter {
67
64
testIds : string [ ] ,
68
65
debugBool ?: boolean ,
69
66
executionFactory ?: IPythonExecutionFactory ,
70
- debugLauncher ?: ITestDebugLauncher ,
71
67
) : Promise < ExecutionTestPayload > {
72
68
const deferred = createDeferred < ExecutionTestPayload > ( ) ;
73
69
const relativePathToPytest = 'pythonFiles' ;
@@ -110,29 +106,16 @@ export class PytestTestExecutionAdapter implements ITestExecutionAdapter {
110
106
testArgs . splice ( 0 , 0 , '--rootdir' , uri . fsPath ) ;
111
107
}
112
108
113
- // why is this needed?
114
109
if ( debugBool && ! testArgs . some ( ( a ) => a . startsWith ( '--capture' ) || a === '-s' ) ) {
115
110
testArgs . push ( '--capture' , 'no' ) ;
116
111
}
117
- const pluginArgs = [ '-p' , 'vscode_pytest' , '-v' ] . concat ( testArgs ) . concat ( testIds ) ;
118
- if ( debugBool ) {
119
- const pytestPort = this . testServer . getPort ( ) . toString ( ) ;
120
- const pytestUUID = uuid . toString ( ) ;
121
- const launchOptions : LaunchOptions = {
122
- cwd : uri . fsPath ,
123
- args : pluginArgs ,
124
- token : spawnOptions . token ,
125
- testProvider : PYTEST_PROVIDER ,
126
- pytestPort,
127
- pytestUUID,
128
- } ;
129
- console . debug ( `Running debug test with arguments: ${ pluginArgs . join ( ' ' ) } \r\n` ) ;
130
- await debugLauncher ! . launchDebugger ( launchOptions ) ;
131
- } else {
132
- const runArgs = [ '-m' , 'pytest' ] . concat ( pluginArgs ) ;
133
- console . debug ( `Running test with arguments: ${ runArgs . join ( ' ' ) } \r\n` ) ;
134
- execService ?. exec ( runArgs , spawnOptions ) ;
135
- }
112
+
113
+ console . debug ( `Running test with arguments: ${ testArgs . join ( ' ' ) } \r\n` ) ;
114
+ console . debug ( `Current working directory: ${ uri . fsPath } \r\n` ) ;
115
+
116
+ const argArray = [ '-m' , 'pytest' , '-p' , 'vscode_pytest' ] . concat ( testArgs ) . concat ( testIds ) ;
117
+ console . debug ( 'argArray' , argArray ) ;
118
+ execService ?. exec ( argArray , spawnOptions ) ;
136
119
} catch ( ex ) {
137
120
console . debug ( `Error while running tests: ${ testIds } \r\n${ ex } \r\n\r\n` ) ;
138
121
return Promise . reject ( ex ) ;
0 commit comments