Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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 @@ -42,6 +42,8 @@ export async function buildDjangoLaunchDebugConfiguration(
if (selectedProgram) {
manuallyEnteredAValue = true;
config.program = selectedProgram;
} else {
return;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ export async function buildFastAPILaunchDebugConfiguration(
if (selectedPath) {
manuallyEnteredAValue = true;
config.args = [`${path.basename(selectedPath, '.py').replace('/', '.')}:app`, '--reload'];
} else {
return;
}
}

Expand Down
2 changes: 2 additions & 0 deletions src/extension/debugger/configuration/providers/flaskLaunch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ export async function buildFlaskLaunchDebugConfiguration(
if (selectedApp) {
manuallyEnteredAValue = true;
config.env!.FLASK_APP = selectedApp;
} else {
return;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ export async function buildModuleLaunchConfiguration(
if (selectedModule) {
manuallyEnteredAValue = true;
config.module = selectedModule;
} else {
return;
}

sendTelemetryEvent(EventName.DEBUGGER_CONFIGURATION_PROMPTS, undefined, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ export async function buildPyramidLaunchConfiguration(
if (selectedIniPath) {
manuallyEnteredAValue = true;
config.args = [selectedIniPath];
} else {
return;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@ export async function buildRemoteAttachConfiguration(
value && value.trim().length > 0 ? undefined : DebugConfigStrings.attach.enterRemoteHost.invalid,
),
});

if (!connect.host) {
connect.host = defaultHost;
return;
}

sendTelemetryEvent(EventName.DEBUGGER_CONFIGURATION_PROMPTS, undefined, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ suite('Debugging - Configuration Provider Django', () => {
const workspaceFolderToken = '${workspaceFolder}';
const defaultProgram = `${workspaceFolderToken}-manage.py`;
pathSeparatorStub.value('-');
when(input.showInputBox(anything())).thenResolve();
when(input.showInputBox(anything())).thenResolve(defaultProgram);
await djangoLaunch.buildDjangoLaunchDebugConfiguration(instance(input), state);

const config = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,23 +42,6 @@ suite('Debugging - Configuration Provider FastAPI', () => {

expect(file).to.be.equal('main.py');
});
test('Launch JSON with valid python path', async () => {
const folder = { uri: Uri.parse(path.join('one', 'two')), name: '1', index: 0 };
const state = { config: {}, folder };

await fastApiLaunch.buildFastAPILaunchDebugConfiguration(instance(input), state);

const config = {
name: DebugConfigStrings.fastapi.snippet.name,
type: DebuggerTypeName,
request: 'launch',
module: 'uvicorn',
args: ['main:app', '--reload'],
jinja: true,
};

expect(state.config).to.be.deep.equal(config);
});
test('Launch JSON with selected app path', async () => {
const folder = { uri: Uri.parse(path.join('one', 'two')), name: '1', index: 0 };
const state = { config: {}, folder };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,27 +41,6 @@ suite('Debugging - Configuration Provider Flask', () => {

expect(file).to.be.equal('app.py');
});
test('Launch JSON with valid python path', async () => {
const folder = { uri: Uri.parse(path.join('one', 'two')), name: '1', index: 0 };
const state = { config: {}, folder };

await flaskLaunch.buildFlaskLaunchDebugConfiguration(instance(input), state);

const config = {
name: DebugConfigStrings.flask.snippet.name,
type: DebuggerTypeName,
request: 'launch',
module: 'flask',
env: {
FLASK_APP: 'app.py',
FLASK_DEBUG: '1',
},
args: ['run', '--no-debugger', '--no-reload'],
jinja: true,
};

expect(state.config).to.be.deep.equal(config);
});
test('Launch JSON with selected app path', async () => {
const folder = { uri: Uri.parse(path.join('one', 'two')), name: '1', index: 0 };
const state = { config: {}, folder };
Expand All @@ -88,7 +67,7 @@ suite('Debugging - Configuration Provider Flask', () => {
test('Launch JSON with default managepy path', async () => {
const folder = { uri: Uri.parse(path.join('one', 'two')), name: '1', index: 0 };
const state = { config: {}, folder };
when(input.showInputBox(anything())).thenResolve();
when(input.showInputBox(anything())).thenResolve('app.py');

await flaskLaunch.buildFlaskLaunchDebugConfiguration(instance(input), state);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ suite('Debugging - Configuration Provider Module', () => {
const state = { config: {}, folder };
const input = mock<MultiStepInput<DebugConfigurationState>>(MultiStepInput);

when(input.showInputBox(anything())).thenResolve();
when(input.showInputBox(anything())).thenResolve('enter-your-module-name');

await buildModuleLaunchConfiguration(instance(input), state);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ suite('Debugging - Configuration Provider Pyramid', () => {
const folder = { uri: Uri.parse(path.join('one', 'two')), name: '1', index: 0 };
const state = { config: {}, folder };
pathSeparatorStub.value('-');
when(input.showInputBox(anything())).thenResolve('${workspaceFolder}-development.ini');

await pyramidLaunch.buildPyramidLaunchConfiguration(instance(input), state);

Expand Down Expand Up @@ -141,7 +142,7 @@ suite('Debugging - Configuration Provider Pyramid', () => {
const defaultIni = `${workspaceFolderToken}-development.ini`;

pathSeparatorStub.value('-');
when(input.showInputBox(anything())).thenResolve();
when(input.showInputBox(anything())).thenResolve(defaultIni);

await pyramidLaunch.buildPyramidLaunchConfiguration(instance(input), state);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ suite('Debugging - Configuration Provider Remote Attach', () => {
const folder = { uri: Uri.parse(path.join('one', 'two')), name: '1', index: 0 };
const state = { config: {}, folder };
let portConfigured = false;
when(input.showInputBox(anything())).thenResolve();
when(input.showInputBox(anything())).thenResolve('localhost');

sinon.stub(configuration, 'configurePort').callsFake(async () => {
portConfigured = true;
Expand Down