If vstest.console.exe is passed /InIsolation or /EnableCodeCoverage the PTVS Test Adater fails in TestExecutor.cs:RunTests from these sequence of events:
- Due to Isolation being used the Test Adapter is running inside vstest.executionengine*.exe.
- The execution engine gets passed a /parentProcessId argument, but that PID isn't Visual Studio.
- VisualStudioApp.FromCommandLineArgs() returns a non-NULL instance of VisualStudioApp.
- InterpreterOptionsServiceProvider.GetService() receives the non-NULL instance.
- InterpreterOptionsServiceProvider.GetService calls app.DTE which returns NULL due to the parent process not being VisualStudio.
- InterpreterOptionsServiceProvider.GetService passes in NULL to "new ServiceProvider" which throws an ArgumentNullException and the PTVS Test Adapter ends up crashing as a result.
If we avoid trying to create the "new ServiceProvider" then the Test Adapter successfully runs the Python test cases.
Given the various ways one could go about solving this problem it seems easiest to let someone on the project pick their way. :)