From f202ad526255c62aef165bcc6487d7dc052f540c Mon Sep 17 00:00:00 2001 From: Kartik Raj Date: Mon, 18 Mar 2019 14:41:19 -0700 Subject: [PATCH 1/8] Correct Smoke test failure for 'Run Python File In Terminal' --- src/test/smoke/runInTerminal.smoke.test.ts | 2 +- .../smokeTests/testExecInTerminal.py | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/test/smoke/runInTerminal.smoke.test.ts b/src/test/smoke/runInTerminal.smoke.test.ts index ba2efae820b1..013e6bff396d 100644 --- a/src/test/smoke/runInTerminal.smoke.test.ts +++ b/src/test/smoke/runInTerminal.smoke.test.ts @@ -43,7 +43,7 @@ suite('Smoke Test: Run Python File In Terminal', () => { } const textDocument = await openFile(file); - await vscode.commands.executeCommand('python.execInTerminal', textDocument.uri, outputFile); + await vscode.commands.executeCommand('python.execInTerminal', textDocument.uri); const checkIfFileHasBeenCreated = () => fs.pathExists(outputFile); await waitForCondition(checkIfFileHasBeenCreated, 30_000, `"${outputFile}" file not created`); }); diff --git a/src/testMultiRootWkspc/smokeTests/testExecInTerminal.py b/src/testMultiRootWkspc/smokeTests/testExecInTerminal.py index 022a160544db..d83d46a740d9 100644 --- a/src/testMultiRootWkspc/smokeTests/testExecInTerminal.py +++ b/src/testMultiRootWkspc/smokeTests/testExecInTerminal.py @@ -3,11 +3,14 @@ import os optlist, args = getopt.getopt(sys.argv, '') -if len(args) < 2: - help_msg = '{} requires 1 parameter - the full path specification of the logfile to write.'.format(args[0]) - raise RuntimeError(help_msg) - -log_file = args[1] + +# If the caller has not specified the output file, create one for them with +# the same name as the caller script, but with a .log extension. +log_file = os.path.splitext(sys.argv[0])[0] + '.log' + +# If the output file is given, use that instead. +if len(args) == 2: + log_file = args[1] with open(log_file, "a") as f: f.write(sys.executable) From 7c4c65633d8cd273f1ce54fc0fe347d8001db2c4 Mon Sep 17 00:00:00 2001 From: Kartik Raj Date: Mon, 18 Mar 2019 14:42:45 -0700 Subject: [PATCH 2/8] news entry --- news/3 Code Health/4515.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 news/3 Code Health/4515.md diff --git a/news/3 Code Health/4515.md b/news/3 Code Health/4515.md new file mode 100644 index 000000000000..96a01b5bc58a --- /dev/null +++ b/news/3 Code Health/4515.md @@ -0,0 +1 @@ +Corrected Smoke test failure for 'Run Python File In Terminal' From 801bde68a53b7306b5356a882bf728ebfe789b5c Mon Sep 17 00:00:00 2001 From: Kartik Raj Date: Mon, 18 Mar 2019 15:06:52 -0700 Subject: [PATCH 3/8] Run smoke tests on CI --- build/ci/vscode-python-pr-validation.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build/ci/vscode-python-pr-validation.yaml b/build/ci/vscode-python-pr-validation.yaml index 052af7a6bda5..5a4de27cdd61 100644 --- a/build/ci/vscode-python-pr-validation.yaml +++ b/build/ci/vscode-python-pr-validation.yaml @@ -40,7 +40,7 @@ jobs: # UploadBinary: [true|false] - upload test binaries to Azure if true. False if not set. 'Win-Py3.7 Unit': VMImageName: 'vs2017-win2016' - TestsToRun: 'runHygiene, testUnitTests, pythonUnitTests' + TestsToRun: 'runHygiene, testUnitTests, pythonUnitTests, testSmoke' NeedsPythonTestReqs: true 'Win-Py2.7 Unit': PythonVersion: '2.7' @@ -50,7 +50,7 @@ jobs: 'Mac-Py3.7 Unit+Single': PythonVersion: '3.7' VMImageName: 'macos-10.13' - TestsToRun: 'testUnitTests, pythonUnitTests, testSingleWorkspace' + TestsToRun: 'testUnitTests, pythonUnitTests, testSingleWorkspace, testSmoke' NeedsPythonTestReqs: true 'Mac-Py2.7 Unit+Single': PythonVersion: '2.7' @@ -60,7 +60,7 @@ jobs: 'Linux-Py3.7 Unit+Single': PythonVersion: '3.7' VMImageName: 'ubuntu-16.04' - TestsToRun: 'testUnitTests, pythonUnitTests, testSingleWorkspace' + TestsToRun: 'testUnitTests, pythonUnitTests, testSingleWorkspace, testSmoke' NeedsPythonTestReqs: true 'Linux-Py2.7 Unit+Single': PythonVersion: '2.7' From a7672d4c09ca7cc7f9bdf738da5f5915472100d9 Mon Sep 17 00:00:00 2001 From: Kartik Raj Date: Mon, 18 Mar 2019 16:04:21 -0700 Subject: [PATCH 4/8] Catch errors and continue execution --- src/test/smokeTest.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/test/smokeTest.ts b/src/test/smokeTest.ts index 1ed8412ce5de..3828480430fe 100644 --- a/src/test/smokeTest.ts +++ b/src/test/smokeTest.ts @@ -17,9 +17,9 @@ import { EXTENSION_ROOT_DIR_FOR_TESTS, SMOKE_TEST_EXTENSIONS_DIR } from './const class TestRunner { public async start() { - await this.enableLanguageServer(true); - await this.extractLatestExtension(SMOKE_TEST_EXTENSIONS_DIR); - await this.launchSmokeTests(); + await this.enableLanguageServer(true).catch(ex => console.error('Error in enabling language server', ex)); + await this.extractLatestExtension(SMOKE_TEST_EXTENSIONS_DIR).catch(ex => console.error('Error in extracting latest extension', ex)); + await this.launchSmokeTests().catch(ex => console.error('Error in launching Smoke Tests', ex)); } private async launchSmokeTests() { const env: Record = { From 98f2fbad5d43367ff5966d5925bc790cc2dc5984 Mon Sep 17 00:00:00 2001 From: Kartik Raj Date: Mon, 18 Mar 2019 16:53:09 -0700 Subject: [PATCH 5/8] correct CI --- src/test/smokeTest.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/smokeTest.ts b/src/test/smokeTest.ts index 3828480430fe..9164f0e831b5 100644 --- a/src/test/smokeTest.ts +++ b/src/test/smokeTest.ts @@ -17,7 +17,7 @@ import { EXTENSION_ROOT_DIR_FOR_TESTS, SMOKE_TEST_EXTENSIONS_DIR } from './const class TestRunner { public async start() { - await this.enableLanguageServer(true).catch(ex => console.error('Error in enabling language server', ex)); + await this.enableLanguageServer(true); await this.extractLatestExtension(SMOKE_TEST_EXTENSIONS_DIR).catch(ex => console.error('Error in extracting latest extension', ex)); await this.launchSmokeTests().catch(ex => console.error('Error in launching Smoke Tests', ex)); } From b2ddc09036288cccd6c23c747ca7bef6e6ef9da9 Mon Sep 17 00:00:00 2001 From: Kartik Raj Date: Tue, 19 Mar 2019 15:28:13 -0700 Subject: [PATCH 6/8] Corrected build number and install --- build/ci/templates/test_phases.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build/ci/templates/test_phases.yml b/build/ci/templates/test_phases.yml index 026ed150740d..41c49d1bb67d 100644 --- a/build/ci/templates/test_phases.yml +++ b/build/ci/templates/test_phases.yml @@ -414,8 +414,9 @@ steps: # > npx gulp clean:cleanExceptTests # > npm run testSmoke - script: | + npm install -g vsce npm run clean - npm run updateBuildNumber -- --buildNumber $TRAVIS_BUILD_NUMBER + npm run updateBuildNumber -- --buildNumber $BUILD_BUILDID npm run package npx gulp clean:cleanExceptTests npm run testSmoke From dcdab21b936712ec70c8cd724272aba5dc79c6e1 Mon Sep 17 00:00:00 2001 From: Kartik Raj Date: Tue, 19 Mar 2019 15:52:39 -0700 Subject: [PATCH 7/8] CI --- build/ci/templates/test_phases.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/ci/templates/test_phases.yml b/build/ci/templates/test_phases.yml index 41c49d1bb67d..2e4cf0bf2a92 100644 --- a/build/ci/templates/test_phases.yml +++ b/build/ci/templates/test_phases.yml @@ -413,7 +413,7 @@ steps: # > npm run package # > npx gulp clean:cleanExceptTests # > npm run testSmoke - - script: | + - bash: | npm install -g vsce npm run clean npm run updateBuildNumber -- --buildNumber $BUILD_BUILDID From 900b93cdbc6974fbf731b89a023f08c5beb2b40d Mon Sep 17 00:00:00 2001 From: Kartik Raj Date: Tue, 19 Mar 2019 16:50:37 -0700 Subject: [PATCH 8/8] Code review --- build/ci/vscode-python-pr-validation.yaml | 2 +- src/test/smokeTest.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build/ci/vscode-python-pr-validation.yaml b/build/ci/vscode-python-pr-validation.yaml index 5a4de27cdd61..70cb8e2fab40 100644 --- a/build/ci/vscode-python-pr-validation.yaml +++ b/build/ci/vscode-python-pr-validation.yaml @@ -40,7 +40,7 @@ jobs: # UploadBinary: [true|false] - upload test binaries to Azure if true. False if not set. 'Win-Py3.7 Unit': VMImageName: 'vs2017-win2016' - TestsToRun: 'runHygiene, testUnitTests, pythonUnitTests, testSmoke' + TestsToRun: 'runHygiene, testUnitTests, pythonUnitTests' NeedsPythonTestReqs: true 'Win-Py2.7 Unit': PythonVersion: '2.7' diff --git a/src/test/smokeTest.ts b/src/test/smokeTest.ts index 9164f0e831b5..1ed8412ce5de 100644 --- a/src/test/smokeTest.ts +++ b/src/test/smokeTest.ts @@ -18,8 +18,8 @@ import { EXTENSION_ROOT_DIR_FOR_TESTS, SMOKE_TEST_EXTENSIONS_DIR } from './const class TestRunner { public async start() { await this.enableLanguageServer(true); - await this.extractLatestExtension(SMOKE_TEST_EXTENSIONS_DIR).catch(ex => console.error('Error in extracting latest extension', ex)); - await this.launchSmokeTests().catch(ex => console.error('Error in launching Smoke Tests', ex)); + await this.extractLatestExtension(SMOKE_TEST_EXTENSIONS_DIR); + await this.launchSmokeTests(); } private async launchSmokeTests() { const env: Record = {