Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
1f54c99
Add FinalTestStatus and NonPassingTestStatus.
ericsnowcurrently Feb 11, 2021
97dfa95
Use composition to define the TestStatus types.
ericsnowcurrently Feb 11, 2021
515eb23
Make IPythonTestMessage.status a FinalTestStatus.
ericsnowcurrently Feb 11, 2021
4eb63f6
Factor out IPythonTestMessageCommon.
ericsnowcurrently Feb 11, 2021
8b1ae13
Make all IPythonTestMessageCommon properties required.
ericsnowcurrently Feb 11, 2021
0008206
Add NonPassingTestSeverity and NonPassingTestMessageType.
ericsnowcurrently Feb 11, 2021
8bd1d36
Revert "Use composition to define the TestStatus types."
ericsnowcurrently Feb 11, 2021
9b2b23f
Factor out ITestPassMessage and ITestFailMessage.
ericsnowcurrently Feb 11, 2021
e1d167a
"Fail" -> "NonPassing".
ericsnowcurrently Feb 11, 2021
8f3771c
Pass ITestNonPassingMessage to BaseTestManager.createDiagnostics().
ericsnowcurrently Feb 11, 2021
2165720
Compose IPythonTestMessage from ITestPassingMessage and ITestNonPassi…
ericsnowcurrently Feb 11, 2021
f1ce005
Only pass non-passing values to UnitTestDiagnosticService.
ericsnowcurrently Feb 11, 2021
8088933
Use the specific types in TestMessageService.getFilteredTestMessages().
ericsnowcurrently Feb 11, 2021
6557621
Factor out BaseTestManager.getDiagnosticMessage().
ericsnowcurrently Feb 11, 2021
6583e96
Add a note.
ericsnowcurrently Feb 11, 2021
ba3fab3
Compose isNonPassingTestStatus() more dynamically.
ericsnowcurrently Feb 16, 2021
6e0d5c4
eslint
ericsnowcurrently Feb 17, 2021
df5c6d8
eslint
ericsnowcurrently Feb 17, 2021
dd97ae8
eslint
ericsnowcurrently Feb 17, 2021
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
19 changes: 0 additions & 19 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,6 @@ src/test/testing/codeLenses/testFiles.unit.test.ts
src/test/testing/nosetest/nosetest.test.ts
src/test/testing/nosetest/nosetest.disovery.test.ts
src/test/testing/nosetest/nosetest.run.test.ts
src/test/testing/pytest/pytest.testMessageService.test.ts
src/test/testing/pytest/pytest_unittest_parser_data.ts
src/test/testing/pytest/pytest.test.ts
src/test/testing/pytest/pytest_run_tests_data.ts
src/test/testing/pytest/services/discoveryService.unit.test.ts
src/test/testing/rediscover.test.ts
src/test/testing/helper.ts
src/test/testing/navigation/fileNavigator.unit.test.ts
Expand All @@ -140,7 +135,6 @@ src/test/testing/navigation/suiteNavigator.unit.test.ts
src/test/testing/navigation/commandHandlers.unit.test.ts
src/test/testing/navigation/helper.unit.test.ts
src/test/testing/navigation/symbolNavigator.unit.test.ts
src/test/testing/configuration.unit.test.ts
src/test/testing/explorer/treeView.unit.test.ts
src/test/testing/explorer/testExplorerCommandHandler.unit.test.ts
src/test/testing/explorer/failedTestHandler.unit.test.ts
Expand All @@ -151,8 +145,6 @@ src/test/testing/banners/proposeNewLanguageServerBanner.unit.test.ts
src/test/testing/common/argsHelper.unit.test.ts
src/test/testing/common/trackEnablement.unit.test.ts
src/test/testing/common/debugLauncher.unit.test.ts
src/test/testing/common/managers/baseTestManager.unit.test.ts
src/test/testing/common/managers/testConfigurationManager.unit.test.ts
src/test/testing/common/testUtils.unit.test.ts
src/test/testing/common/testVisitors/resultResetVisitor.unit.test.ts
src/test/testing/common/services/discoveredTestParser.unit.test.ts
Expand Down Expand Up @@ -443,12 +435,6 @@ src/client/testing/nosetest/services/parserService.ts
src/client/testing/nosetest/services/argsService.ts
src/client/testing/nosetest/services/discoveryService.ts
src/client/testing/main.ts
src/client/testing/pytest/main.ts
src/client/testing/pytest/testConfigurationManager.ts
src/client/testing/pytest/runner.ts
src/client/testing/pytest/services/argsService.ts
src/client/testing/pytest/services/discoveryService.ts
src/client/testing/pytest/services/testMessageService.ts
src/client/testing/configurationFactory.ts
src/client/testing/navigation/serviceRegistry.ts
src/client/testing/navigation/symbolProvider.ts
Expand All @@ -462,13 +448,9 @@ src/client/testing/explorer/testTreeViewProvider.ts
src/client/testing/explorer/commandHandlers.ts
src/client/testing/explorer/failedTestHandler.ts
src/client/testing/explorer/treeView.ts
src/client/testing/types.ts
src/client/testing/common/argumentsHelper.ts
src/client/testing/common/enablementTracker.ts
src/client/testing/common/debugLauncher.ts
src/client/testing/common/managers/testConfigurationManager.ts
src/client/testing/common/managers/baseTestManager.ts
src/client/testing/common/types.ts
src/client/testing/common/constants.ts
src/client/testing/common/testUtils.ts
src/client/testing/common/xUnitParser.ts
Expand All @@ -481,7 +463,6 @@ src/client/testing/common/services/contextService.ts
src/client/testing/common/services/testResultsService.ts
src/client/testing/common/services/storageService.ts
src/client/testing/common/services/types.ts
src/client/testing/common/services/unitTestDiagnosticService.ts
src/client/testing/common/services/testsStatusService.ts
src/client/testing/common/services/discovery.ts
src/client/testing/common/services/configSettingService.ts
Expand Down
4 changes: 2 additions & 2 deletions src/client/activation/jedi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import { PythonRenameProvider } from '../providers/renameProvider';
import { PythonSignatureProvider } from '../providers/signatureProvider';
import { JediSymbolProvider } from '../providers/symbolProvider';
import { PythonEnvironment } from '../pythonEnvironments/info';
import { ITestManagementService } from '../testing/types';
import { ITestingService } from '../testing/types';
import { BlockFormatProviders } from '../typeFormatters/blockFormatProvider';
import { OnTypeFormattingDispatcher } from '../typeFormatters/dispatcher';
import { OnEnterFormatter } from '../typeFormatters/onEnterFormatter';
Expand Down Expand Up @@ -94,7 +94,7 @@ export class JediExtensionActivator implements ILanguageServerActivator {
context.subscriptions.push(JediExtensionActivator.workspaceSymbols);
}

const testManagementService = this.serviceManager.get<ITestManagementService>(ITestManagementService);
const testManagementService = this.serviceManager.get<ITestingService>(ITestingService);
testManagementService
.activate(this.symbolProvider)
.catch((ex) => traceError('Failed to activate Unit Tests', ex));
Expand Down
4 changes: 2 additions & 2 deletions src/client/activation/jedi/languageServerProxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { LanguageServerSymbolProvider } from '../../providers/symbolProvider';
import { PythonEnvironment } from '../../pythonEnvironments/info';
import { captureTelemetry } from '../../telemetry';
import { EventName } from '../../telemetry/constants';
import { ITestManagementService } from '../../testing/types';
import { ITestingService } from '../../testing/types';
import { FileBasedCancellationStrategy } from '../common/cancellationUtils';
import { LanguageClientMiddleware } from '../languageClientMiddleware';
import { ProgressReporting } from '../progress';
Expand All @@ -43,7 +43,7 @@ export class JediLanguageServerProxy implements ILanguageServerProxy {

constructor(
@inject(ILanguageClientFactory) private readonly factory: ILanguageClientFactory,
@inject(ITestManagementService) private readonly testManager: ITestManagementService,
@inject(ITestingService) private readonly testManager: ITestingService,
@inject(IExperimentsManager) private readonly experiments: IExperimentsManager,
@inject(IInterpreterPathService) private readonly interpreterPathService: IInterpreterPathService,
) {
Expand Down
4 changes: 2 additions & 2 deletions src/client/activation/languageServer/languageServerProxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { LanguageServerSymbolProvider } from '../../providers/symbolProvider';
import { PythonEnvironment } from '../../pythonEnvironments/info';
import { captureTelemetry, sendTelemetryEvent } from '../../telemetry';
import { EventName } from '../../telemetry/constants';
import { ITestManagementService } from '../../testing/types';
import { ITestingService } from '../../testing/types';
import { ProgressReporting } from '../progress';
import { ILanguageClientFactory, ILanguageServerProxy } from '../types';

Expand All @@ -28,7 +28,7 @@ export class DotNetLanguageServerProxy implements ILanguageServerProxy {

constructor(
@inject(ILanguageClientFactory) private readonly factory: ILanguageClientFactory,
@inject(ITestManagementService) private readonly testManager: ITestManagementService,
@inject(ITestingService) private readonly testManager: ITestingService,
@inject(IConfigurationService) private readonly configurationService: IConfigurationService,
) {
this.startupCompleted = createDeferred<void>();
Expand Down
4 changes: 2 additions & 2 deletions src/client/activation/node/languageServerProxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import { LanguageServerSymbolProvider } from '../../providers/symbolProvider';
import { PythonEnvironment } from '../../pythonEnvironments/info';
import { captureTelemetry, sendTelemetryEvent } from '../../telemetry';
import { EventName } from '../../telemetry/constants';
import { ITestManagementService } from '../../testing/types';
import { ITestingService } from '../../testing/types';
import { FileBasedCancellationStrategy } from '../common/cancellationUtils';
import { ProgressReporting } from '../progress';
import { ILanguageClientFactory, ILanguageServerFolderService, ILanguageServerProxy } from '../types';
Expand Down Expand Up @@ -68,7 +68,7 @@ export class NodeLanguageServerProxy implements ILanguageServerProxy {

constructor(
@inject(ILanguageClientFactory) private readonly factory: ILanguageClientFactory,
@inject(ITestManagementService) private readonly testManager: ITestManagementService,
@inject(ITestingService) private readonly testManager: ITestingService,
@inject(IConfigurationService) private readonly configurationService: IConfigurationService,
@inject(ILanguageServerFolderService) private readonly folderService: ILanguageServerFolderService,
@inject(IExperimentsManager) private readonly experiments: IExperimentsManager,
Expand Down
22 changes: 17 additions & 5 deletions src/client/common/application/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,12 @@

'use strict';

import { CancellationToken, Position, TextDocument, Uri } from 'vscode';
import { CancellationToken, Disposable, Position, TextDocument, Uri } from 'vscode';
import { Commands as LSCommands } from '../../activation/commands';
import { TensorBoardEntrypoint, TensorBoardEntrypointTrigger } from '../../tensorBoard/constants';
import { CommandSource } from '../../testing/common/constants';
import { TestFunction, TestsToRun } from '../../testing/common/types';
import { TestDataItem, TestWorkspaceFolder } from '../../testing/types';
import { TestDataItem, TestFunction, TestsToRun, TestWorkspaceFolder } from '../../testing/common/types';
import { Commands } from '../constants';
import { Channel } from './types';
import { Channel, CommandSource, ICommandManager } from './types';

export type CommandsWithoutArgs = keyof ICommandNameWithoutArgumentTypeMapping;

Expand Down Expand Up @@ -129,3 +127,17 @@ export interface ICommandNameArgumentTypeMapping extends ICommandNameWithoutArgu
[Commands.navigateToTestSuite]: [Uri, TestDataItem, boolean];
[Commands.LaunchTensorBoard]: [TensorBoardEntrypoint, TensorBoardEntrypointTrigger];
}

//export const IPythonCommandManager = Symbol('IPythonCommandManager');
export interface IPythonCommandManager extends ICommandManager {
registerCommand<E extends keyof ICommandNameArgumentTypeMapping, U extends ICommandNameArgumentTypeMapping[E]>(
command: E,
callback: (...args: U) => any,
thisArg?: any,
): Disposable;

executeCommand<T, E extends keyof ICommandNameArgumentTypeMapping, U extends ICommandNameArgumentTypeMapping[E]>(
command: E,
...rest: U
): Thenable<T | undefined>;
}
20 changes: 10 additions & 10 deletions src/client/common/application/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,14 @@ import type {
} from 'vscode-proposed';

import { IAsyncDisposable, Resource } from '../types';
import { ICommandNameArgumentTypeMapping } from './commands';

export enum CommandSource {
auto = 'auto',
ui = 'ui',
codelens = 'codelens',
commandPalette = 'commandpalette',
testExplorer = 'testExplorer',
}

export const IApplicationShell = Symbol('IApplicationShell');
export interface IApplicationShell {
Expand Down Expand Up @@ -445,11 +452,7 @@ export interface ICommandManager {
* @param thisArg The `this` context used when invoking the handler function.
* @return Disposable which unregisters this command on disposal.
*/
registerCommand<E extends keyof ICommandNameArgumentTypeMapping, U extends ICommandNameArgumentTypeMapping[E]>(
command: E,
callback: (...args: U) => any,
thisArg?: any,
): Disposable;
registerCommand(command: string, callback: (...args: any[]) => any, thisArg?: any): Disposable;

/**
* Registers a text editor command that can be invoked via a keyboard shortcut,
Expand Down Expand Up @@ -485,10 +488,7 @@ export interface ICommandManager {
* @return A thenable that resolves to the returned value of the given command. `undefined` when
* the command handler function doesn't return anything.
*/
executeCommand<T, E extends keyof ICommandNameArgumentTypeMapping, U extends ICommandNameArgumentTypeMapping[E]>(
command: E,
...rest: U
): Thenable<T | undefined>;
executeCommand<T>(command: string, ...rest: any[]): Thenable<T | undefined>;

/**
* Retrieve the list of all available commands. Commands starting an underscore are
Expand Down
2 changes: 1 addition & 1 deletion src/client/common/configSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { LogLevel } from '../logging/levels';
import { sendTelemetryEvent } from '../telemetry';
import { EventName } from '../telemetry/constants';
import { sendSettingTelemetry } from '../telemetry/envFileTelemetry';
import { ITestingSettings } from '../testing/configuration/types';
import { IWorkspaceService } from './application/types';
import { WorkspaceService } from './application/workspace';
import { DEFAULT_INTERPRETER_SETTING, isTestExecution } from './constants';
Expand All @@ -40,7 +41,6 @@ import {
IPythonSettings,
ISortImportSettings,
ITerminalSettings,
ITestingSettings,
IWorkspaceSymbolSettings,
LoggingLevelSettingType,
Resource,
Expand Down
4 changes: 2 additions & 2 deletions src/client/common/installer/productPath.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { Uri } from 'vscode';
import { IFormatterHelper } from '../../formatters/types';
import { IServiceContainer } from '../../ioc/types';
import { ILinterManager } from '../../linters/types';
import { ITestsHelper } from '../../testing/common/types';
import { ITestingService } from '../../testing/types';
import { IConfigurationService, IInstaller, ModuleNamePurpose, Product } from '../types';
import { IProductPathService } from './types';

Expand Down Expand Up @@ -78,7 +78,7 @@ export class TestFrameworkProductPathService extends BaseProductPathsService {
super(serviceContainer);
}
public getExecutableNameFromSettings(product: Product, resource?: Uri): string {
const testHelper = this.serviceContainer.get<ITestsHelper>(ITestsHelper);
const testHelper = this.serviceContainer.get<ITestingService>(ITestingService);
const settingsPropNames = testHelper.getSettingsPropertyNames(product);
if (!settingsPropNames.pathName) {
// E.g. in the case of UnitTests we don't allow customizing the paths.
Expand Down
3 changes: 2 additions & 1 deletion src/client/common/serviceRegistry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { ApplicationEnvironment } from './application/applicationEnvironment';
import { ApplicationShell } from './application/applicationShell';
import { ClipboardService } from './application/clipboard';
import { CommandManager } from './application/commandManager';
import { IPythonCommandManager } from './application/commands';
import { ReloadVSCodeCommandHandler } from './application/commands/reloadCommand';
import { CustomEditorService } from './application/customEditorService';
import { DebugService } from './application/debugService';
Expand Down Expand Up @@ -143,7 +144,7 @@ export function registerTypes(serviceManager: IServiceManager) {
IJupyterExtensionDependencyManager,
JupyterExtensionDependencyManager,
);
serviceManager.addSingleton<ICommandManager>(ICommandManager, CommandManager);
serviceManager.addSingleton<IPythonCommandManager>(ICommandManager, CommandManager);
serviceManager.addSingleton<IConfigurationService>(IConfigurationService, ConfigurationService);
serviceManager.addSingleton<IWorkspaceService>(IWorkspaceService, WorkspaceService);
serviceManager.addSingleton<IProcessLogger>(IProcessLogger, ProcessLogger);
Expand Down
2 changes: 1 addition & 1 deletion src/client/common/startPage/startPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import { ConfigurationTarget, EventEmitter, UIKind, Uri, ViewColumn } from 'vsco
import { IExtensionSingleActivationService } from '../../activation/types';
import { EXTENSION_ROOT_DIR } from '../../constants';
import { sendTelemetryEvent } from '../../telemetry';
import { CommandSource } from '../../testing/common/constants';
import {
CommandSource,
IApplicationEnvironment,
IApplicationShell,
ICommandManager,
Expand Down
15 changes: 1 addition & 14 deletions src/client/common/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import type { CommandsWithoutArgs } from './application/commands';
import type { ExtensionChannels } from './insidersBuild/types';
import type { InterpreterUri } from './installer/types';
import { EnvironmentVariables } from './variables/types';
import { ITestingSettings } from '../testing/configuration/types';

export const IOutputChannel = Symbol('IOutputChannel');
export interface IOutputChannel extends OutputChannel {}
Expand Down Expand Up @@ -211,20 +212,6 @@ export interface ISortImportSettings {
readonly args: string[];
}

export interface ITestingSettings {
readonly promptToConfigure: boolean;
readonly debugPort: number;
readonly nosetestsEnabled: boolean;
nosetestPath: string;
nosetestArgs: string[];
readonly pytestEnabled: boolean;
pytestPath: string;
pytestArgs: string[];
readonly unittestEnabled: boolean;
unittestArgs: string[];
cwd?: string;
readonly autoTestDiscoverOnSaveEnabled: boolean;
}
export interface IPylintCategorySeverity {
readonly convention: DiagnosticSeverity;
readonly refactor: DiagnosticSeverity;
Expand Down
4 changes: 2 additions & 2 deletions src/client/extensionActivation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ import { setExtensionInstallTelemetryProperties } from './telemetry/extensionIns
import { registerTypes as tensorBoardRegisterTypes } from './tensorBoard/serviceRegistry';
import { registerTypes as commonRegisterTerminalTypes } from './terminals/serviceRegistry';
import { ICodeExecutionManager, ITerminalAutoActivation } from './terminals/types';
import { ITestContextService } from './testing/common/types';
import { ITestCodeNavigatorCommandHandler, ITestExplorerCommandHandler } from './testing/navigation/types';
import { registerTypes as unitTestsRegisterTypes } from './testing/serviceRegistry';
import { ITestingService } from './testing/types';
import { registerTypes as interpretersRegisterTypes } from './interpreter/serviceRegistry';

// components
Expand Down Expand Up @@ -173,7 +173,7 @@ async function activateLegacy(ext: ExtensionState): Promise<ActivationResult> {
serviceContainer.get<ITestCodeNavigatorCommandHandler>(ITestCodeNavigatorCommandHandler).register();
serviceContainer.get<ITestExplorerCommandHandler>(ITestExplorerCommandHandler).register();
serviceContainer.get<ILanguageServerExtension>(ILanguageServerExtension).register();
serviceContainer.get<ITestContextService>(ITestContextService).register();
serviceContainer.get<ITestingService>(ITestingService).register();

// "activate" everything else

Expand Down
2 changes: 1 addition & 1 deletion src/client/extensionInit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { IServiceContainer, IServiceManager } from './ioc/types';
import { addOutputChannelLogging } from './logging';
import * as pythonEnvironments from './pythonEnvironments';
import { PythonEnvironments } from './pythonEnvironments/api';
import { TEST_OUTPUT_CHANNEL } from './testing/common/constants';
import { TEST_OUTPUT_CHANNEL } from './testing/constants';

// The code in this module should do nothing more complex than register
// objects to DI and simple init (e.g. no side effects). That implies
Expand Down
2 changes: 1 addition & 1 deletion src/client/telemetry/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {
TensorBoardSessionStartResult,
TensorBoardEntrypoint,
} from '../tensorBoard/constants';
import { TestProvider } from '../testing/common/types';
import { TestProvider } from '../testing/types';
import { EventName, PlatformErrors } from './constants';
import type { LinterTrigger, TestTool } from './types';

Expand Down
2 changes: 1 addition & 1 deletion src/client/testing/codeLenses/testFiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ import {
TextDocument,
Uri,
} from 'vscode';
import { CommandSource } from '../../common/application/types';
import { IWorkspaceService } from '../../../client/common/application/types';
import { IFileSystem } from '../../../client/common/platform/types';
import { IServiceContainer } from '../../../client/ioc/types';
import * as constants from '../../common/constants';
import { CommandSource } from '../common/constants';
import {
ITestCollectionStorageService,
TestFile,
Expand Down
2 changes: 1 addition & 1 deletion src/client/testing/common/argumentsHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import { injectable } from 'inversify';
import { traceWarning } from '../../common/logger';
import { IArgumentsHelper } from '../types';
import { IArgumentsHelper } from '../common/types';

@injectable()
export class ArgumentsHelper implements IArgumentsHelper {
Expand Down
11 changes: 2 additions & 9 deletions src/client/testing/common/constants.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
import { Product } from '../../common/types';
import { TestProvider, UnitTestProduct } from './types';
import { TestProvider } from '../types';
import { UnitTestProduct } from './types';

export const CANCELLATION_REASON = 'cancelled_user_request';
export enum CommandSource {
auto = 'auto',
ui = 'ui',
codelens = 'codelens',
commandPalette = 'commandpalette',
testExplorer = 'testExplorer',
}
export const TEST_OUTPUT_CHANNEL = 'TEST_OUTPUT_CHANNEL';

export const UNIT_TEST_PRODUCTS: UnitTestProduct[] = [Product.pytest, Product.unittest, Product.nosetest];
export const NOSETEST_PROVIDER: TestProvider = 'nosetest';
Expand Down
Loading