Skip to content

chore(onboarding): test the public api of the onboarding snippets in python #91119

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 7, 2025
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
68 changes: 58 additions & 10 deletions static/app/utils/gettingStartedDocs/python.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,74 @@ jest.mock('sentry/utils/gettingStartedDocs/python', () => {
};
});

import {getPythonInstallSnippet} from 'sentry/utils/gettingStartedDocs/python';
import {getPythonInstallConfig} from 'sentry/utils/gettingStartedDocs/python';

describe('getPythonInstallSnippet', () => {
describe('getPythonInstallConfig', () => {
it('generates install commands with default parameters', () => {
const result = getPythonInstallSnippet({
const result = getPythonInstallConfig({
packageName: 'sentry-sdk',
description: 'Install the Sentry SDK',
});

expect(result.pip).toBe(`pip install "sentry-sdk"`);
expect(result.uv).toBe(`uv add "sentry-sdk"`);
expect(result.poetry).toBe(`poetry add "sentry-sdk"`);
expect(result).toEqual([
{
description: 'Install the Sentry SDK',
language: 'bash',
code: [
{
label: 'pip',
value: 'pip',
language: 'bash',
code: `pip install "sentry-sdk"`,
},
{
label: 'uv',
value: 'uv',
language: 'bash',
code: `uv add "sentry-sdk"`,
},
{
label: 'poetry',
value: 'poetry',
language: 'bash',
code: `poetry add "sentry-sdk"`,
},
],
},
]);
});

it('generates pip install command with minimum version and extras', () => {
const result = getPythonInstallSnippet({
const result = getPythonInstallConfig({
packageName: 'sentry-sdk[with-extras]',
description: 'Install the Sentry SDK',
minimumVersion: '2.3.4',
});
expect(result.pip).toBe(`pip install --upgrade "sentry-sdk[with-extras]>=2.3.4"`);
expect(result.uv).toBe(`uv add --upgrade "sentry-sdk[with-extras]>=2.3.4"`);
expect(result.poetry).toBe(`poetry add "sentry-sdk[with-extras]>=2.3.4"`);
expect(result).toEqual([
{
description: 'Install the Sentry SDK',
language: 'bash',
code: [
{
label: 'pip',
value: 'pip',
language: 'bash',
code: `pip install --upgrade "sentry-sdk[with-extras]>=2.3.4"`,
},
{
label: 'uv',
value: 'uv',
language: 'bash',
code: `uv add --upgrade "sentry-sdk[with-extras]>=2.3.4"`,
},
{
label: 'poetry',
value: 'poetry',
language: 'bash',
code: `poetry add "sentry-sdk[with-extras]>=2.3.4"`,
},
],
},
]);
});
});
10 changes: 1 addition & 9 deletions static/app/utils/gettingStartedDocs/python.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import type {
import {AlternativeConfiguration} from 'sentry/gettingStartedDocs/python/python';
import {t, tct} from 'sentry/locale';

export function getPythonInstallSnippet({
function getPythonInstallSnippet({
packageName,
minimumVersion,
}: {
Expand Down Expand Up @@ -72,14 +72,6 @@ export function getPythonInstallConfig({
];
}

export function getPythonProfilingMinVersionMessage() {
return tct(
'You need a minimum version [code:2.24.1] of the [code:sentry-python] SDK for the profiling feature.',
{
code: <code />,
}
);
}
export function getPythonAiocontextvarsConfig({
description,
}: {
Expand Down
Loading