55
66import * as chaiAsPromised from 'chai-as-promised' ;
77import * as path from 'path' ;
8+ import * as TypeMoq from 'typemoq' ;
89import * as sinon from 'sinon' ;
910import { use , expect } from 'chai' ;
1011import { EXTENSION_ROOT_DIR_FOR_TESTS } from '../../constants' ;
1112import { PythonInlineValueProvider } from '../../../extension/debugger/inlineValue/pythonInlineValueProvider' ;
12- import { workspace , Range , InlineValueContext } from 'vscode' ;
13+ import { workspace , Range , InlineValueContext , WorkspaceConfiguration } from 'vscode' ;
1314import * as vscodeapi from '../../../extension/common/vscodeapi' ;
1415
1516use ( chaiAsPromised ) ;
@@ -18,16 +19,27 @@ const WS_ROOT = path.join(EXTENSION_ROOT_DIR_FOR_TESTS, 'src', 'test');
1819
1920suite ( 'Debugging - pythonInlineProvider' , ( ) => {
2021 let customRequestStub : sinon . SinonStub ;
22+ let getConfigurationStub : sinon . SinonStub ;
2123
2224 setup ( ( ) => {
2325 customRequestStub = sinon . stub ( vscodeapi , 'customRequest' ) ;
2426 customRequestStub . withArgs ( 'scopes' , sinon . match . any ) . resolves ( { scopes : [ { variablesReference : 0 } ] } ) ;
27+ getConfigurationStub = sinon . stub ( vscodeapi , 'getConfiguration' ) ;
28+ getConfigurationStub . withArgs ( 'debugpy' ) . returns ( createMoqConfiguration ( true ) ) ;
2529 } ) ;
2630
2731 teardown ( async ( ) => {
2832 sinon . restore ( ) ;
2933 } ) ;
3034
35+ function createMoqConfiguration ( showPythonInlineValues : boolean ) {
36+ const debugpySettings = TypeMoq . Mock . ofType < WorkspaceConfiguration > ( ) ;
37+ debugpySettings
38+ . setup ( ( p ) => p . get < boolean > ( 'showPythonInlineValues' , TypeMoq . It . isAny ( ) ) )
39+ . returns ( ( ) => showPythonInlineValues ) ;
40+ return debugpySettings . object ;
41+ }
42+
3143 test ( 'ProvideInlineValues function should return all the vars in the python file' , async ( ) => {
3244 customRequestStub . withArgs ( 'variables' , sinon . match . any ) . resolves ( {
3345 variables : [
@@ -331,7 +343,7 @@ suite('Debugging - pythonInlineProvider', () => {
331343 expect ( result ) . to . deep . equal ( expected ) ;
332344 } ) ;
333345
334- test . only ( 'ProvideInlineValues function should return all the vars in the python file using Assignment Expressions' , async ( ) => {
346+ test ( 'ProvideInlineValues function should return all the vars in the python file using Assignment Expressions' , async ( ) => {
335347 customRequestStub . withArgs ( 'variables' , sinon . match . any ) . resolves ( {
336348 variables : [
337349 {
0 commit comments