Skip to content

Commit

Permalink
Revert logging changes
Browse files Browse the repository at this point in the history
  • Loading branch information
DonJayamanne committed Mar 18, 2019
1 parent 9496c27 commit f3a5859
Showing 1 changed file with 6 additions and 22 deletions.
28 changes: 6 additions & 22 deletions src/client/unittests/common/services/discovery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,7 @@ import { EXTENSION_ROOT_DIR } from '../../../constants';
import { captureTelemetry } from '../../../telemetry';
import { EventName } from '../../../telemetry/constants';
import { ITestDiscoveryService, TestDiscoveryOptions, Tests } from '../types';
import { ITestDiscoveredTestParser } from './types';

type TestContainer = {
id: string;
kind: 'file' | 'folder' | 'suite' | 'function';
name: string;
parentid: string;
};
type TestItem = {
id: string;
name: string;
source: string;
parentid: string;
};
type DiscoveredTests = {
rootid: string;
root: string;
parents: TestContainer[];
tests: TestItem[];
};
import { DiscoveredTests, ITestDiscoveredTestParser } from './types';

const DISCOVERY_FILE = path.join(EXTENSION_ROOT_DIR, 'pythonFiles', 'testing_tools', 'run_adapter.py');

Expand All @@ -40,12 +21,15 @@ export class TestsDiscoveryService implements ITestDiscoveryService {
@inject(ITestDiscoveredTestParser) private readonly parser: ITestDiscoveredTestParser) { }
@captureTelemetry(EventName.UNITTEST_DISCOVER_WITH_PYCODE, undefined, true)
public async discoverTests(options: TestDiscoveryOptions): Promise<Tests> {
const output = await this.exec(options);
let output: ExecutionResult<string> | undefined;
try {
output = await this.exec(options);
const discoveredTests = JSON.parse(output.stdout) as DiscoveredTests[];
return this.parser.parse(options.workspaceFolder, discoveredTests);
} catch (ex) {
traceError('Failed to parse discovered Test', new Error(output.stdout));
if (output) {
traceError('Failed to parse discovered Test', new Error(output.stdout));
}
traceError('Failed to parse discovered Test', ex);
throw ex;
}
Expand Down

0 comments on commit f3a5859

Please sign in to comment.