Skip to content

Commit 17f9647

Browse files
author
Kartik Raj
authored
Corrected Smoke test failure for 'Run Python File In Terminal' (#4809)
* Correct Smoke test failure for 'Run Python File In Terminal' * news entry * Run smoke tests on CI * Catch errors and continue execution * correct CI * Corrected build number and install * CI * Code review
1 parent faefc70 commit 17f9647

File tree

5 files changed

+15
-10
lines changed

5 files changed

+15
-10
lines changed

build/ci/templates/test_phases.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -413,9 +413,10 @@ steps:
413413
# > npm run package
414414
# > npx gulp clean:cleanExceptTests
415415
# > npm run testSmoke
416-
- script: |
416+
- bash: |
417+
npm install -g vsce
417418
npm run clean
418-
npm run updateBuildNumber -- --buildNumber $TRAVIS_BUILD_NUMBER
419+
npm run updateBuildNumber -- --buildNumber $BUILD_BUILDID
419420
npm run package
420421
npx gulp clean:cleanExceptTests
421422
npm run testSmoke

build/ci/vscode-python-pr-validation.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050
'Mac-Py3.7 Unit+Single':
5151
PythonVersion: '3.7'
5252
VMImageName: 'macos-10.13'
53-
TestsToRun: 'testUnitTests, pythonUnitTests, testSingleWorkspace'
53+
TestsToRun: 'testUnitTests, pythonUnitTests, testSingleWorkspace, testSmoke'
5454
NeedsPythonTestReqs: true
5555
'Mac-Py2.7 Unit+Single':
5656
PythonVersion: '2.7'
@@ -60,7 +60,7 @@ jobs:
6060
'Linux-Py3.7 Unit+Single':
6161
PythonVersion: '3.7'
6262
VMImageName: 'ubuntu-16.04'
63-
TestsToRun: 'testUnitTests, pythonUnitTests, testSingleWorkspace'
63+
TestsToRun: 'testUnitTests, pythonUnitTests, testSingleWorkspace, testSmoke'
6464
NeedsPythonTestReqs: true
6565
'Linux-Py2.7 Unit+Single':
6666
PythonVersion: '2.7'

news/3 Code Health/4515.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Corrected Smoke test failure for 'Run Python File In Terminal'

src/test/smoke/runInTerminal.smoke.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ suite('Smoke Test: Run Python File In Terminal', () => {
4343
}
4444
const textDocument = await openFile(file);
4545

46-
await vscode.commands.executeCommand<void>('python.execInTerminal', textDocument.uri, outputFile);
46+
await vscode.commands.executeCommand<void>('python.execInTerminal', textDocument.uri);
4747
const checkIfFileHasBeenCreated = () => fs.pathExists(outputFile);
4848
await waitForCondition(checkIfFileHasBeenCreated, 30_000, `"${outputFile}" file not created`);
4949
});

src/testMultiRootWkspc/smokeTests/testExecInTerminal.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,14 @@
33
import os
44

55
optlist, args = getopt.getopt(sys.argv, '')
6-
if len(args) < 2:
7-
help_msg = '{} requires 1 parameter - the full path specification of the logfile to write.'.format(args[0])
8-
raise RuntimeError(help_msg)
9-
10-
log_file = args[1]
6+
7+
# If the caller has not specified the output file, create one for them with
8+
# the same name as the caller script, but with a .log extension.
9+
log_file = os.path.splitext(sys.argv[0])[0] + '.log'
10+
11+
# If the output file is given, use that instead.
12+
if len(args) == 2:
13+
log_file = args[1]
1114

1215
with open(log_file, "a") as f:
1316
f.write(sys.executable)

0 commit comments

Comments
 (0)