Skip to content

Commit 89d3322

Browse files
committed
this test has bad vibes
1 parent 45e6021 commit 89d3322

File tree

1 file changed

+0
-77
lines changed

1 file changed

+0
-77
lines changed

src/test/testing/common/unittestingAdapter.test.ts

Lines changed: 0 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -519,81 +519,4 @@ suite('End to End Tests: unittest adapters', () => {
519519
assert.strictEqual(failureOccurred, false, failureMsg);
520520
});
521521
});
522-
test('unittest execution adapter RuntimeError handling', async () => {
523-
resultResolver = new PythonResultResolver(testController, unittestProvider, workspaceUri);
524-
let callCount = 0;
525-
let failureOccurred = false;
526-
let failureMsg = '';
527-
resultResolver._resolveExecution = async (data, _token?) => {
528-
// do the following asserts for each time resolveExecution is called, should be called once per test.
529-
callCount = callCount + 1;
530-
traceLog(`unittest execution adapter seg fault error handling \n ${JSON.stringify(data)}`);
531-
try {
532-
if (data.status === 'error') {
533-
if (data.error === undefined) {
534-
// Dereference a NULL pointer
535-
const indexOfTest = JSON.stringify(data).search('RuntimeError');
536-
if (indexOfTest === -1) {
537-
failureOccurred = true;
538-
failureMsg = 'Expected test to have a RuntimeError';
539-
}
540-
} else if (data.error.length === 0) {
541-
failureOccurred = true;
542-
failureMsg = "Expected errors in 'error' field";
543-
}
544-
} else {
545-
const indexOfTest = JSON.stringify(data.result).search('error');
546-
if (indexOfTest === -1) {
547-
failureOccurred = true;
548-
failureMsg =
549-
'If payload status is not error then the individual tests should be marked as errors. This should occur on windows machines.';
550-
}
551-
}
552-
if (data.result === undefined) {
553-
failureOccurred = true;
554-
failureMsg = 'Expected results to be present';
555-
}
556-
// make sure the testID is found in the results
557-
const indexOfTest = JSON.stringify(data).search('test_runtime_error.TestRuntimeError.test_exception');
558-
if (indexOfTest === -1) {
559-
failureOccurred = true;
560-
failureMsg = 'Expected testId to be present';
561-
}
562-
} catch (err) {
563-
failureMsg = err ? (err as Error).toString() : '';
564-
failureOccurred = true;
565-
}
566-
return Promise.resolve();
567-
};
568-
569-
const testId = 'test_runtime_error.TestRuntimeError.test_exception';
570-
const testIds: string[] = [testId];
571-
572-
// set workspace to test workspace folder
573-
workspaceUri = Uri.parse(rootPathErrorWorkspace);
574-
configService.getSettings(workspaceUri).testing.unittestArgs = ['-s', '.', '-p', '*test*.py'];
575-
576-
// run pytest execution
577-
const executionAdapter = new UnittestTestExecutionAdapter(
578-
configService,
579-
testOutputChannel.object,
580-
resultResolver,
581-
envVarsService,
582-
);
583-
const testRun = typeMoq.Mock.ofType<TestRun>();
584-
testRun
585-
.setup((t) => t.token)
586-
.returns(
587-
() =>
588-
({
589-
onCancellationRequested: () => undefined,
590-
} as any),
591-
);
592-
await executionAdapter
593-
.runTests(workspaceUri, testIds, TestRunProfileKind.Run, testRun.object, pythonExecFactory)
594-
.finally(() => {
595-
assert.strictEqual(callCount, 1, 'Expected _resolveExecution to be called once');
596-
assert.strictEqual(failureOccurred, false, failureMsg);
597-
});
598-
});
599522
});

0 commit comments

Comments
 (0)