Skip to content

Commit

Permalink
check the error message in "both pyright and basedpyright in pyprojec…
Browse files Browse the repository at this point in the history
…t.toml" test
  • Loading branch information
DetachHead committed Jan 29, 2025
1 parent 98a55f5 commit 86ef7c9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/pyright-internal/src/tests/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import { TestFileSystem } from './harness/vfs/filesystem';
import { AnalysisResults } from '../analyzer/analysis';
import { existsSync } from 'fs';
import { NoAccessHost } from '../common/host';
import { tExpect } from 'typed-jest-expect';

class ErrorTrackingNullConsole extends NullConsole {
errors = new Array<string>();
Expand Down Expand Up @@ -400,9 +401,12 @@ describe(`config test'}`, () => {
});

test('both pyright and basedpyright in pyproject.toml', () => {
const { configOptions, analysisResult } = setupPyprojectToml(
const { configOptions, analysisResult, consoleErrors } = setupPyprojectToml(
'src/tests/samples/project_with_both_config_sections_in_pyproject_toml'
);
tExpect(consoleErrors[0]).toStrictEqual(
'Pyproject file parse attempt 1 Error: Pyproject file cannot have both `pyright` and `basedpyright` sections. pick one'
);
// ensure it defaults to the current python interpreter instead of the version from either section in the config.
// https://github.com/microsoft/pyright/pull/9735
assert.strictEqual(configOptions.defaultPythonVersion!, pythonVersion3_13);
Expand Down

0 comments on commit 86ef7c9

Please sign in to comment.