From 86ef7c94d03095020002660a27f73168373e11d2 Mon Sep 17 00:00:00 2001 From: detachhead Date: Wed, 29 Jan 2025 19:17:09 +1000 Subject: [PATCH] check the error message in "both pyright and basedpyright in pyproject.toml" test --- packages/pyright-internal/src/tests/config.test.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/pyright-internal/src/tests/config.test.ts b/packages/pyright-internal/src/tests/config.test.ts index 5359b8897..ac264c379 100644 --- a/packages/pyright-internal/src/tests/config.test.ts +++ b/packages/pyright-internal/src/tests/config.test.ts @@ -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(); @@ -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);