From add21931016e3a6323fcbf01f91338da6c679b3b Mon Sep 17 00:00:00 2001 From: Eric Traut Date: Tue, 11 Jun 2024 13:11:42 -0700 Subject: [PATCH] Fixed subtle bug in a test case that was resulting in a long hang during unit tests. --- packages/pyright-internal/src/analyzer/service.ts | 2 +- packages/pyright-internal/src/tests/config.test.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/pyright-internal/src/analyzer/service.ts b/packages/pyright-internal/src/analyzer/service.ts index 13ab77ed4..7483894d4 100644 --- a/packages/pyright-internal/src/analyzer/service.ts +++ b/packages/pyright-internal/src/analyzer/service.ts @@ -522,7 +522,7 @@ export class AnalyzerService { const optionRoot = commandLineOptions.executionRoot; const executionRootUri = Uri.is(optionRoot) ? optionRoot - : isString(optionRoot) + : isString(optionRoot) && optionRoot.length > 0 ? Uri.file(optionRoot, this.serviceProvider, /* checkRelative */ true) : Uri.defaultWorkspace(this.serviceProvider); diff --git a/packages/pyright-internal/src/tests/config.test.ts b/packages/pyright-internal/src/tests/config.test.ts index f3f2f9dc9..621e99f7d 100644 --- a/packages/pyright-internal/src/tests/config.test.ts +++ b/packages/pyright-internal/src/tests/config.test.ts @@ -323,7 +323,7 @@ test('BasicPyprojectTomlParsing', () => { test('FindFilesInMemoryOnly', () => { const cwd = normalizePath(process.cwd()); const service = createAnalyzer(); - const commandLineOptions = new CommandLineOptions('', /* fromVsCodeExtension */ true); + const commandLineOptions = new CommandLineOptions(undefined, /* fromVsCodeExtension */ true); // Force a lookup of the typeshed path. This causes us to try and generate a module path for the untitled file. commandLineOptions.typeshedPath = combinePaths(cwd, 'src', 'tests', 'samples'); service.setOptions(commandLineOptions);