Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -564,11 +564,8 @@ export class Conda {
return undefined;
}
const args = [];
if (env.name) {
args.push('-n', env.name);
} else {
args.push('-p', env.prefix);
}
args.push('-p', env.prefix);

const python = [
forShellExecution ? this.shellCommand : this.command,
'run',
Expand Down
12 changes: 6 additions & 6 deletions src/test/common/process/pythonEnvironment.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -284,16 +284,16 @@ suite('CondaEnvironment', () => {

teardown(() => sinon.restore());

test('getExecutionInfo with a named environment should return execution info using the environment name', async () => {
test('getExecutionInfo with a named environment should return execution info using the environment path', async () => {
const condaInfo = { name: 'foo', path: 'bar' };
const env = await createCondaEnv(condaInfo, processService.object, fileSystem.object);

const result = env?.getExecutionInfo(args, pythonPath);

expect(result).to.deep.equal({
command: condaFile,
args: ['run', '-n', condaInfo.name, '--no-capture-output', 'python', OUTPUT_MARKER_SCRIPT, ...args],
python: [condaFile, 'run', '-n', condaInfo.name, '--no-capture-output', 'python', OUTPUT_MARKER_SCRIPT],
args: ['run', '-p', condaInfo.path, '--no-capture-output', 'python', OUTPUT_MARKER_SCRIPT, ...args],
python: [condaFile, 'run', '-p', condaInfo.path, '--no-capture-output', 'python', OUTPUT_MARKER_SCRIPT],
pythonExecutable: pythonPath,
});
});
Expand All @@ -312,12 +312,12 @@ suite('CondaEnvironment', () => {
});
});

test('getExecutionObservableInfo with a named environment should return execution info using conda full path with the name', async () => {
test('getExecutionObservableInfo with a named environment should return execution info using conda full path with the path', async () => {
const condaInfo = { name: 'foo', path: 'bar' };
const expected = {
command: condaFile,
args: ['run', '-n', condaInfo.name, '--no-capture-output', 'python', OUTPUT_MARKER_SCRIPT, ...args],
python: [condaFile, 'run', '-n', condaInfo.name, '--no-capture-output', 'python', OUTPUT_MARKER_SCRIPT],
args: ['run', '-p', condaInfo.path, '--no-capture-output', 'python', OUTPUT_MARKER_SCRIPT, ...args],
python: [condaFile, 'run', '-p', condaInfo.path, '--no-capture-output', 'python', OUTPUT_MARKER_SCRIPT],
pythonExecutable: pythonPath,
};
const env = await createCondaEnv(condaInfo, processService.object, fileSystem.object);
Expand Down
Loading