11'use strict' ;
22import * as vscode from 'vscode' ;
3- import { Tests , TestsToRun , TestFolder , TestFile , TestStatus , TestSuite , TestFunction , FlattenedTestFunction , CANCELLATION_REASON } from './common/contracts' ;
3+ import { TestsToRun , TestStatus , TestFunction , FlattenedTestFunction , CANCELLATION_REASON } from './common/contracts' ;
44import * as nosetests from './nosetest/main' ;
55import * as pytest from './pytest/main' ;
66import * as unittest from './unittest/main' ;
77import { resolveValueAsTestToRun , getDiscoveredTests } from './common/testUtils' ;
88import { BaseTestManager } from './common/baseTestManager' ;
9- import { PythonSettings , IUnitTestSettings } from '../common/configSettings' ;
9+ import { PythonSettings } from '../common/configSettings' ;
1010import { TestResultDisplay } from './display/main' ;
1111import { TestDisplay } from './display/picker' ;
12- import * as fs from 'fs' ;
13- import * as path from 'path' ;
1412import * as constants from '../common/constants' ;
1513import { activateCodeLenses } from './codeLenses/main' ;
16- import { Product } from '../common/installer ' ;
14+ import { displayTestFrameworkError } from './configuration ' ;
1715
1816const settings = PythonSettings . getInstance ( ) ;
1917let testManager : BaseTestManager ;
@@ -23,7 +21,6 @@ let nosetestManager: nosetests.TestManager;
2321let testResultDisplay : TestResultDisplay ;
2422let testDisplay : TestDisplay ;
2523let outChannel : vscode . OutputChannel ;
26- let lastRanTests : TestsToRun = null ;
2724
2825export function activate ( context : vscode . ExtensionContext , outputChannel : vscode . OutputChannel ) {
2926 context . subscriptions . push ( { dispose : dispose } ) ;
@@ -152,44 +149,6 @@ function onConfigChanged() {
152149 // No need to display errors
153150 discoverTests ( true , true ) ;
154151}
155- function promptToEnableTestFramework ( ) {
156- const items = [ {
157- label : 'unittest' , settingToEnable : 'unitTest.unittestEnabled' ,
158- description : 'Standard Python test framework' ,
159- detail : 'https://docs.python.org/2/library/unittest.html'
160- } ,
161- {
162- label : 'pytest' , settingToEnable : 'unitTest.pyTestEnabled' ,
163- description : 'Can run unittest (including trial) and nose test suites out of the box' ,
164- detail : 'http://docs.pytest.org/en/latest/'
165- } ,
166- {
167- label : 'nose' , settingToEnable : 'unitTest.nosetestsEnabled' ,
168- description : 'nose framework' ,
169- detail : 'https://docs.python.org/2/library/unittest.html'
170- } ] ;
171- vscode . window . showQuickPick ( items , { matchOnDescription : true , matchOnDetail : true , placeHolder : 'Select a test framework/tool to enable' } ) . then ( item => {
172- if ( ! item ) {
173- return ;
174- }
175- const pythonConfig = vscode . workspace . getConfiguration ( 'python' ) ;
176- pythonConfig . update ( item . settingToEnable , true ) ;
177- } ) ;
178- }
179- function displayTestFrameworkError ( ) {
180- if ( settings . unitTest . pyTestEnabled && settings . unitTest . nosetestsEnabled && settings . unitTest . unittestEnabled ) {
181- vscode . window . showErrorMessage ( "Enable only one of the test frameworks (nosetest or pytest), not both." ) ;
182- }
183- else {
184- const option = 'Enable a Test Framework/Tool' ;
185- vscode . window . showInformationMessage ( 'Please enable one of the test frameworks (unittest, pytest or nosetest)' , option ) . then ( item => {
186- if ( item === option ) {
187- promptToEnableTestFramework ( ) ;
188- }
189- } ) ;
190- }
191- return null ;
192- }
193152function getTestRunner ( ) {
194153 const rootDirectory = vscode . workspace . rootPath ;
195154 if ( settings . unitTest . nosetestsEnabled ) {
0 commit comments