| 118 | } |
| 119 | |
| 120 | export async function submitFromPythonFile( |
| 121 | interactiveWindowProvider: IInteractiveWindowProvider, |
| 122 | source: string, |
| 123 | disposables: vscode.Disposable[], |
| 124 | apiProvider?: IPythonApiProvider, |
| 125 | activeInterpreterPath?: vscode.Uri |
| 126 | ) { |
| 127 | const api = await initialize(); |
| 128 | const tempFile = await createTemporaryFile({ contents: source, extension: '.py' }); |
| 129 | disposables.push(tempFile); |
| 130 | const untitledPythonFile = await vscode.workspace.openTextDocument(tempFile.file); |
| 131 | await vscode.window.showTextDocument(untitledPythonFile); |
| 132 | if (apiProvider && activeInterpreterPath) { |
| 133 | const interpreterService = api.serviceContainer.get<IInterpreterService>(IInterpreterService); |
| 134 | await setActiveInterpreter(apiProvider, untitledPythonFile.uri, activeInterpreterPath); |
| 135 | await interpreterService.refreshInterpreters(); |
| 136 | const interpreter = await interpreterService.getActiveInterpreter(); |
| 137 | assert.ok( |
| 138 | isEqual(interpreter?.uri, activeInterpreterPath), |
| 139 | `Active interpreter not set, actual ${interpreter?.uri.fsPath}, expected ${activeInterpreterPath}` |
| 140 | ); |
| 141 | } |
| 142 | const activeInteractiveWindow = await runCurrentFile(interactiveWindowProvider, untitledPythonFile); |
| 143 | const notebook = await waitForInteractiveWindow(activeInteractiveWindow); |
| 144 | await verifySelectedControllerIsRemoteForRemoteTests(notebook); |
| 145 | return { activeInteractiveWindow, untitledPythonFile }; |
| 146 | } |
| 147 | |
| 148 | export async function submitFromPythonFileUsingCodeWatcher( |
| 149 | source: string, |