@@ -164,10 +164,10 @@ suite('Unit Tests - Debug Launcher', () => {
164164 if ( ! pythonTestAdapterRewriteExperiment ) {
165165 switch ( testProvider ) {
166166 case 'unittest' : {
167- return path . join ( EXTENSION_ROOT_DIR , 'python_files' , 'visualstudio_py_testlauncher .py' ) ;
167+ return path . join ( EXTENSION_ROOT_DIR , 'python_files' , 'unittestadapter' , 'execution .py') ;
168168 }
169169 case 'pytest' : {
170- return path . join ( EXTENSION_ROOT_DIR , 'python_files' , 'testlauncher .py' ) ;
170+ return path . join ( EXTENSION_ROOT_DIR , 'python_files' , 'vscode_pytest' , 'run_pytest_script .py') ;
171171 }
172172 default : {
173173 throw new Error ( `Unknown test provider '${ testProvider } '` ) ;
@@ -231,6 +231,8 @@ suite('Unit Tests - Debug Launcher', () => {
231231 const pluginPath = path . join ( EXTENSION_ROOT_DIR , 'python_files' ) ;
232232 const pythonPath = `${ pluginPath } ${ path . delimiter } ${ expected . cwd } ` ;
233233 expected . env . PYTHONPATH = pythonPath ;
234+ expected . env . TEST_RUN_PIPE = 'pytestPort' ;
235+ expected . env . RUN_TEST_IDS_PIPE = 'runTestIdsPort' ;
234236
235237 // added by LaunchConfigurationResolver:
236238 if ( ! expected . python ) {
@@ -276,18 +278,26 @@ suite('Unit Tests - Debug Launcher', () => {
276278 cwd : 'one/two/three' ,
277279 args : [ '/one/two/three/testfile.py' ] ,
278280 testProvider,
281+ runTestIdsPort : 'runTestIdsPort' ,
282+ pytestPort : 'pytestPort' ,
279283 } ;
280284 setupSuccess ( options , testProvider ) ;
281285
282286 await debugLauncher . launchDebugger ( options ) ;
283287
284- debugService . verifyAll ( ) ;
288+ try {
289+ debugService . verifyAll ( ) ;
290+ } catch ( ex ) {
291+ console . log ( ex ) ;
292+ }
285293 } ) ;
286294 test ( `Must launch debugger with arguments ${ testTitleSuffix } ` , async ( ) => {
287295 const options = {
288296 cwd : 'one/two/three' ,
289297 args : [ '/one/two/three/testfile.py' , '--debug' , '1' ] ,
290298 testProvider,
299+ runTestIdsPort : 'runTestIdsPort' ,
300+ pytestPort : 'pytestPort' ,
291301 } ;
292302 setupSuccess ( options , testProvider ) ;
293303
@@ -306,7 +316,14 @@ suite('Unit Tests - Debug Launcher', () => {
306316 const cancellationToken = new CancellationTokenSource ( ) ;
307317 cancellationToken . cancel ( ) ;
308318 const token = cancellationToken . token ;
309- const options : LaunchOptions = { cwd : '' , args : [ ] , token, testProvider } ;
319+ const options : LaunchOptions = {
320+ cwd : '' ,
321+ args : [ ] ,
322+ token,
323+ testProvider,
324+ runTestIdsPort : 'runTestIdsPort' ,
325+ pytestPort : 'pytestPort' ,
326+ } ;
310327
311328 await expect ( debugLauncher . launchDebugger ( options ) ) . to . be . eventually . equal ( undefined , 'not undefined' ) ;
312329
@@ -316,10 +333,19 @@ suite('Unit Tests - Debug Launcher', () => {
316333 getWorkspaceFoldersStub . returns ( undefined ) ;
317334 debugService
318335 . setup ( ( d ) => d . startDebugging ( TypeMoq . It . isAny ( ) , TypeMoq . It . isAny ( ) ) )
319- . returns ( ( ) => Promise . resolve ( undefined as any ) )
336+ . returns ( ( ) => {
337+ console . log ( 'Debugging should not start' ) ;
338+ return Promise . resolve ( undefined as any ) ;
339+ } )
320340 . verifiable ( TypeMoq . Times . never ( ) ) ;
321341
322- const options : LaunchOptions = { cwd : '' , args : [ ] , testProvider } ;
342+ const options : LaunchOptions = {
343+ cwd : '' ,
344+ args : [ ] ,
345+ testProvider,
346+ runTestIdsPort : 'runTestIdsPort' ,
347+ pytestPort : 'pytestPort' ,
348+ } ;
323349
324350 await expect ( debugLauncher . launchDebugger ( options ) ) . to . eventually . rejectedWith ( 'Please open a workspace' ) ;
325351
@@ -332,6 +358,8 @@ suite('Unit Tests - Debug Launcher', () => {
332358 cwd : 'one/two/three' ,
333359 args : [ '/one/two/three/testfile.py' ] ,
334360 testProvider : 'unittest' ,
361+ runTestIdsPort : 'runTestIdsPort' ,
362+ pytestPort : 'pytestPort' ,
335363 } ;
336364 const expected = getDefaultDebugConfig ( ) ;
337365 expected . name = 'spam' ;
@@ -348,6 +376,8 @@ suite('Unit Tests - Debug Launcher', () => {
348376 cwd : 'one/two/three' ,
349377 args : [ '/one/two/three/testfile.py' ] ,
350378 testProvider : 'unittest' ,
379+ runTestIdsPort : 'runTestIdsPort' ,
380+ pytestPort : 'pytestPort' ,
351381 } ;
352382 const expected = getDefaultDebugConfig ( ) ;
353383 expected . cwd = 'path/to/settings/cwd' ;
@@ -366,6 +396,8 @@ suite('Unit Tests - Debug Launcher', () => {
366396 cwd : 'one/two/three' ,
367397 args : [ '/one/two/three/testfile.py' ] ,
368398 testProvider : 'unittest' ,
399+ runTestIdsPort : 'runTestIdsPort' ,
400+ pytestPort : 'pytestPort' ,
369401 } ;
370402 const expected = {
371403 name : 'my tests' ,
@@ -381,6 +413,8 @@ suite('Unit Tests - Debug Launcher', () => {
381413 env : {
382414 PYTHONPATH : 'one/two/three' ,
383415 SPAM : 'EGGS' ,
416+ TEST_RUN_PIPE : 'pytestPort' ,
417+ RUN_TEST_IDS_PIPE : 'runTestIdsPort' ,
384418 } ,
385419 envFile : 'some/dir/.env' ,
386420 redirectOutput : false ,
@@ -417,6 +451,8 @@ suite('Unit Tests - Debug Launcher', () => {
417451 cwd : 'one/two/three' ,
418452 args : [ '/one/two/three/testfile.py' ] ,
419453 testProvider : 'unittest' ,
454+ runTestIdsPort : 'runTestIdsPort' ,
455+ pytestPort : 'pytestPort' ,
420456 } ;
421457 const expected = getDefaultDebugConfig ( ) ;
422458 expected . name = 'spam1' ;
@@ -436,6 +472,8 @@ suite('Unit Tests - Debug Launcher', () => {
436472 cwd : 'one/two/three' ,
437473 args : [ '/one/two/three/testfile.py' ] ,
438474 testProvider : 'unittest' ,
475+ runTestIdsPort : 'runTestIdsPort' ,
476+ pytestPort : 'pytestPort' ,
439477 } ;
440478 const expected = getDefaultDebugConfig ( ) ;
441479 setupSuccess ( options , 'unittest' , expected , ']' ) ;
@@ -482,6 +520,8 @@ suite('Unit Tests - Debug Launcher', () => {
482520 cwd : 'one/two/three' ,
483521 args : [ '/one/two/three/testfile.py' ] ,
484522 testProvider : 'unittest' ,
523+ runTestIdsPort : 'runTestIdsPort' ,
524+ pytestPort : 'pytestPort' ,
485525 } ;
486526 const expected = getDefaultDebugConfig ( ) ;
487527 setupSuccess ( options , 'unittest' , expected , text ) ;
@@ -497,6 +537,8 @@ suite('Unit Tests - Debug Launcher', () => {
497537 cwd : 'one/two/three' ,
498538 args : [ '/one/two/three/testfile.py' ] ,
499539 testProvider : 'unittest' ,
540+ runTestIdsPort : 'runTestIdsPort' ,
541+ pytestPort : 'pytestPort' ,
500542 } ;
501543 const expected = getDefaultDebugConfig ( ) ;
502544
@@ -520,6 +562,8 @@ suite('Unit Tests - Debug Launcher', () => {
520562 cwd : 'one/two/three' ,
521563 args : [ '/one/two/three/testfile.py' ] ,
522564 testProvider : 'unittest' ,
565+ runTestIdsPort : 'runTestIdsPort' ,
566+ pytestPort : 'pytestPort' ,
523567 } ;
524568 const expected = getDefaultDebugConfig ( ) ;
525569 setupSuccess ( options , 'unittest' , expected , [ { name : 'foo' , type : 'other' , request : 'bar' } ] ) ;
@@ -534,6 +578,8 @@ suite('Unit Tests - Debug Launcher', () => {
534578 cwd : 'one/two/three' ,
535579 args : [ '/one/two/three/testfile.py' ] ,
536580 testProvider : 'unittest' ,
581+ runTestIdsPort : 'runTestIdsPort' ,
582+ pytestPort : 'pytestPort' ,
537583 } ;
538584 const expected = getDefaultDebugConfig ( ) ;
539585 setupSuccess ( options , 'unittest' , expected , [ { name : 'spam' , type : PythonDebuggerTypeName , request : 'bogus' } ] ) ;
@@ -548,6 +594,8 @@ suite('Unit Tests - Debug Launcher', () => {
548594 cwd : 'one/two/three' ,
549595 args : [ '/one/two/three/testfile.py' ] ,
550596 testProvider : 'unittest' ,
597+ runTestIdsPort : 'runTestIdsPort' ,
598+ pytestPort : 'pytestPort' ,
551599 } ;
552600 const expected = getDefaultDebugConfig ( ) ;
553601 setupSuccess ( options , 'unittest' , expected , [
@@ -565,6 +613,8 @@ suite('Unit Tests - Debug Launcher', () => {
565613 cwd : 'one/two/three' ,
566614 args : [ '/one/two/three/testfile.py' ] ,
567615 testProvider : 'unittest' ,
616+ runTestIdsPort : 'runTestIdsPort' ,
617+ pytestPort : 'pytestPort' ,
568618 } ;
569619 const expected = getDefaultDebugConfig ( ) ;
570620 expected . name = 'spam2' ;
@@ -587,6 +637,8 @@ suite('Unit Tests - Debug Launcher', () => {
587637 cwd : 'one/two/three' ,
588638 args : [ '/one/two/three/testfile.py' ] ,
589639 testProvider : 'unittest' ,
640+ runTestIdsPort : 'runTestIdsPort' ,
641+ pytestPort : 'pytestPort' ,
590642 } ;
591643 const expected = getDefaultDebugConfig ( ) ;
592644 expected . name = 'spam' ;
0 commit comments