From 66874f6df7f8050ef9bee10f7c577bef8a58a548 Mon Sep 17 00:00:00 2001 From: rchiodo Date: Fri, 25 Sep 2020 15:23:39 -0700 Subject: [PATCH 01/19] Add test with a space (only works on flake) --- .../datascience/notebook.functional.test.ts | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/test/datascience/notebook.functional.test.ts b/src/test/datascience/notebook.functional.test.ts index aeec51594400..8fd8e62a0969 100644 --- a/src/test/datascience/notebook.functional.test.ts +++ b/src/test/datascience/notebook.functional.test.ts @@ -11,6 +11,7 @@ import escape = require('lodash/escape'); import * as os from 'os'; import * as path from 'path'; import { SemVer } from 'semver'; +import * as sinon from 'sinon'; import { Readable, Writable } from 'stream'; import { anything, instance, mock, when } from 'ts-mockito'; import * as uuid from 'uuid/v4'; @@ -1489,6 +1490,35 @@ plt.show()`, assert.ok(notebook, 'did not create notebook'); await verifySimple(notebook, `import os\nos.getcwd()`, escapedPath, true); }); + + runTest('Launch with space in path', async () => { + // Move where pyvsc-run-isolated.py is located + const spacedPathDir = path.join(EXTENSION_ROOT_DIR, 'tmp', 'spaced path'); + const spacedPath = path.join(spacedPathDir, 'pyvsc-run-isolated.py'); + await fs.mkdirp(spacedPathDir); + await fs.copyFile(path.join(EXTENSION_ROOT_DIR, 'pythonFiles', 'pyvsc-run-isolated.py'), spacedPath); + + // Stub out the location of the ISOLATED file. + // tslint:disable-next-line: no-require-imports + const pythonModule = require('../../client/common/process/internal/python'); + const execModuleStub = sinon.stub(pythonModule, 'execModule'); + try { + execModuleStub.callsFake((name: string, moduleArgs: string[], isolated: boolean = true) => { + const args = ['-m', name, ...moduleArgs]; + if (isolated) { + args[0] = spacedPath.fileToCommandArgument(); + } + // "code" isn't specific enough to know how to parse it, + // so we only return the args. + return args; + }); + const notebook = await createNotebook(); + assert.ok(notebook, 'did not create notebook'); + await verifySimple(notebook, `a=1\na`, '1', true); + } finally { + execModuleStub.reset(); + } + }); }); }); }); From 6a873658772ed3764f413c77c4eb30f00f29750d Mon Sep 17 00:00:00 2001 From: rchiodo Date: Fri, 25 Sep 2020 16:48:41 -0700 Subject: [PATCH 02/19] Push to insiders.yml only --- .github/workflows/insiders.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/insiders.yml b/.github/workflows/insiders.yml index ba8fa5762ff5..ec2773dc03e1 100644 --- a/.github/workflows/insiders.yml +++ b/.github/workflows/insiders.yml @@ -139,6 +139,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@v2 + with: + path: 'source path' - name: Cache pip files uses: actions/cache@v2 From e0f68c0beaadaafca587269744b6c1f01c1e0496 Mon Sep 17 00:00:00 2001 From: rchiodo Date: Fri, 25 Sep 2020 16:50:36 -0700 Subject: [PATCH 03/19] Remove test that doesn't really do anything --- .../datascience/notebook.functional.test.ts | 29 ------------------- 1 file changed, 29 deletions(-) diff --git a/src/test/datascience/notebook.functional.test.ts b/src/test/datascience/notebook.functional.test.ts index 8fd8e62a0969..a95d67e75d28 100644 --- a/src/test/datascience/notebook.functional.test.ts +++ b/src/test/datascience/notebook.functional.test.ts @@ -1490,35 +1490,6 @@ plt.show()`, assert.ok(notebook, 'did not create notebook'); await verifySimple(notebook, `import os\nos.getcwd()`, escapedPath, true); }); - - runTest('Launch with space in path', async () => { - // Move where pyvsc-run-isolated.py is located - const spacedPathDir = path.join(EXTENSION_ROOT_DIR, 'tmp', 'spaced path'); - const spacedPath = path.join(spacedPathDir, 'pyvsc-run-isolated.py'); - await fs.mkdirp(spacedPathDir); - await fs.copyFile(path.join(EXTENSION_ROOT_DIR, 'pythonFiles', 'pyvsc-run-isolated.py'), spacedPath); - - // Stub out the location of the ISOLATED file. - // tslint:disable-next-line: no-require-imports - const pythonModule = require('../../client/common/process/internal/python'); - const execModuleStub = sinon.stub(pythonModule, 'execModule'); - try { - execModuleStub.callsFake((name: string, moduleArgs: string[], isolated: boolean = true) => { - const args = ['-m', name, ...moduleArgs]; - if (isolated) { - args[0] = spacedPath.fileToCommandArgument(); - } - // "code" isn't specific enough to know how to parse it, - // so we only return the args. - return args; - }); - const notebook = await createNotebook(); - assert.ok(notebook, 'did not create notebook'); - await verifySimple(notebook, `a=1\na`, '1', true); - } finally { - execModuleStub.reset(); - } - }); }); }); }); From 98134f381f37e6903fa4f81248ecf1468a3a5fe7 Mon Sep 17 00:00:00 2001 From: rchiodo Date: Fri, 25 Sep 2020 16:53:38 -0700 Subject: [PATCH 04/19] REmove unused bits --- src/test/datascience/notebook.functional.test.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/test/datascience/notebook.functional.test.ts b/src/test/datascience/notebook.functional.test.ts index a95d67e75d28..aeec51594400 100644 --- a/src/test/datascience/notebook.functional.test.ts +++ b/src/test/datascience/notebook.functional.test.ts @@ -11,7 +11,6 @@ import escape = require('lodash/escape'); import * as os from 'os'; import * as path from 'path'; import { SemVer } from 'semver'; -import * as sinon from 'sinon'; import { Readable, Writable } from 'stream'; import { anything, instance, mock, when } from 'ts-mockito'; import * as uuid from 'uuid/v4'; From eb7e1db5b912e30440849881797f98e71c1ed3e0 Mon Sep 17 00:00:00 2001 From: rchiodo Date: Mon, 28 Sep 2020 14:06:26 -0700 Subject: [PATCH 05/19] Change path to have unicode too --- .github/workflows/insiders.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/insiders.yml b/.github/workflows/insiders.yml index ec2773dc03e1..7179829b30e6 100644 --- a/.github/workflows/insiders.yml +++ b/.github/workflows/insiders.yml @@ -140,7 +140,7 @@ jobs: - name: Checkout uses: actions/checkout@v2 with: - path: 'source path' + path: 'path with chars Ⓛ' - name: Cache pip files uses: actions/cache@v2 From 3cc5127633c1bce8b1b9029337401ed6a6d92da5 Mon Sep 17 00:00:00 2001 From: rchiodo Date: Mon, 28 Sep 2020 14:07:34 -0700 Subject: [PATCH 06/19] Get test to run --- .github/workflows/insiders.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/insiders.yml b/.github/workflows/insiders.yml index 7179829b30e6..1f73e2ce7d1a 100644 --- a/.github/workflows/insiders.yml +++ b/.github/workflows/insiders.yml @@ -4,6 +4,7 @@ on: push: branches: - main + - rchiodo/test_with_space env: PYTHON_VERSION: 3.8 From 315ba130d9da9a78ac12b953d34562c57510c9ca Mon Sep 17 00:00:00 2001 From: rchiodo Date: Mon, 28 Sep 2020 14:37:36 -0700 Subject: [PATCH 07/19] Set root path differently --- .github/workflows/insiders.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/insiders.yml b/.github/workflows/insiders.yml index 1f73e2ce7d1a..fee68fa1e8a4 100644 --- a/.github/workflows/insiders.yml +++ b/.github/workflows/insiders.yml @@ -121,6 +121,8 @@ jobs: name: Tests # The value of runs-on is the OS of the current job (specified in the strategy matrix below) instead of being hardcoded. runs-on: ${{ matrix.os }} + # Force a path with spaces and unicode to test extension works in these scenarios + working-directory: 'path with chars Ⓛ' if: github.repository == 'microsoft/vscode-python' strategy: fail-fast: false @@ -140,8 +142,6 @@ jobs: steps: - name: Checkout uses: actions/checkout@v2 - with: - path: 'path with chars Ⓛ' - name: Cache pip files uses: actions/cache@v2 From 3e82acc50cebd882418a48662c999729819fcd8b Mon Sep 17 00:00:00 2001 From: rchiodo Date: Mon, 28 Sep 2020 14:40:20 -0700 Subject: [PATCH 08/19] Valid dir --- .github/workflows/insiders.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/insiders.yml b/.github/workflows/insiders.yml index fee68fa1e8a4..637356ee4f61 100644 --- a/.github/workflows/insiders.yml +++ b/.github/workflows/insiders.yml @@ -122,7 +122,7 @@ jobs: # The value of runs-on is the OS of the current job (specified in the strategy matrix below) instead of being hardcoded. runs-on: ${{ matrix.os }} # Force a path with spaces and unicode to test extension works in these scenarios - working-directory: 'path with chars Ⓛ' + working-directory: './path with chars Ⓛ' if: github.repository == 'microsoft/vscode-python' strategy: fail-fast: false From 2cb488540d8b1f9bc3101afbe166dc799f115f2d Mon Sep 17 00:00:00 2001 From: rchiodo Date: Mon, 28 Sep 2020 14:44:19 -0700 Subject: [PATCH 09/19] A different way --- .github/workflows/insiders.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/insiders.yml b/.github/workflows/insiders.yml index 637356ee4f61..711dade8dba4 100644 --- a/.github/workflows/insiders.yml +++ b/.github/workflows/insiders.yml @@ -121,8 +121,9 @@ jobs: name: Tests # The value of runs-on is the OS of the current job (specified in the strategy matrix below) instead of being hardcoded. runs-on: ${{ matrix.os }} - # Force a path with spaces and unicode to test extension works in these scenarios - working-directory: './path with chars Ⓛ' + defaults: + # Force a path with spaces and unicode to test extension works in these scenarios + working-directory: './path with chars Ⓛ' if: github.repository == 'microsoft/vscode-python' strategy: fail-fast: false From d66ec8149ef97c415f360573ca1f3440c6df5a26 Mon Sep 17 00:00:00 2001 From: rchiodo Date: Mon, 28 Sep 2020 14:47:56 -0700 Subject: [PATCH 10/19] Another way --- .github/workflows/insiders.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/insiders.yml b/.github/workflows/insiders.yml index 711dade8dba4..201947266d28 100644 --- a/.github/workflows/insiders.yml +++ b/.github/workflows/insiders.yml @@ -122,8 +122,9 @@ jobs: # The value of runs-on is the OS of the current job (specified in the strategy matrix below) instead of being hardcoded. runs-on: ${{ matrix.os }} defaults: - # Force a path with spaces and unicode to test extension works in these scenarios - working-directory: './path with chars Ⓛ' + run: + # Force a path with spaces and unicode to test extension works in these scenarios + working-directory: 'path with chars Ⓛ' if: github.repository == 'microsoft/vscode-python' strategy: fail-fast: false From 94a0d04282c9f64d918a02a384cd8ffb2baa6384 Mon Sep 17 00:00:00 2001 From: rchiodo Date: Mon, 28 Sep 2020 15:09:01 -0700 Subject: [PATCH 11/19] Try creating the directory first --- .github/workflows/insiders.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/insiders.yml b/.github/workflows/insiders.yml index 201947266d28..905946d5f477 100644 --- a/.github/workflows/insiders.yml +++ b/.github/workflows/insiders.yml @@ -142,6 +142,10 @@ jobs: # At this point pinning is only needed for consistency. We no longer have TS debug adapter. NODE_VERSION: 12.15.0 steps: + - name: Create Working Directory + run: mkdir 'path with chars Ⓛ' + working-directory: '.' + - name: Checkout uses: actions/checkout@v2 From 1716099066e10ff7fd2a65351c658fe31d115dac Mon Sep 17 00:00:00 2001 From: rchiodo Date: Mon, 28 Sep 2020 16:16:28 -0700 Subject: [PATCH 12/19] Another try --- .github/workflows/insiders.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/insiders.yml b/.github/workflows/insiders.yml index 905946d5f477..3bb2dcf0a4e0 100644 --- a/.github/workflows/insiders.yml +++ b/.github/workflows/insiders.yml @@ -121,10 +121,13 @@ jobs: name: Tests # The value of runs-on is the OS of the current job (specified in the strategy matrix below) instead of being hardcoded. runs-on: ${{ matrix.os }} + env: + special-working-directory: './path with chars Ⓛ' + special-working-directory-relative: 'path with chars Ⓛ' defaults: run: # Force a path with spaces and unicode to test extension works in these scenarios - working-directory: 'path with chars Ⓛ' + working-directory: ${{env.special-working-directory}} if: github.repository == 'microsoft/vscode-python' strategy: fail-fast: false @@ -142,12 +145,9 @@ jobs: # At this point pinning is only needed for consistency. We no longer have TS debug adapter. NODE_VERSION: 12.15.0 steps: - - name: Create Working Directory - run: mkdir 'path with chars Ⓛ' - working-directory: '.' - - name: Checkout uses: actions/checkout@v2 + path: ${{env.special-working-directory-relative}} - name: Cache pip files uses: actions/cache@v2 From b080db9b54ea279c52922a7ac62ef9ccfabe4dd8 Mon Sep 17 00:00:00 2001 From: rchiodo Date: Mon, 28 Sep 2020 16:18:42 -0700 Subject: [PATCH 13/19] Only one env --- .github/workflows/insiders.yml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/insiders.yml b/.github/workflows/insiders.yml index 3bb2dcf0a4e0..645d9e0041ef 100644 --- a/.github/workflows/insiders.yml +++ b/.github/workflows/insiders.yml @@ -122,11 +122,16 @@ jobs: # The value of runs-on is the OS of the current job (specified in the strategy matrix below) instead of being hardcoded. runs-on: ${{ matrix.os }} env: + # Something in Node 12.16.0 breaks the TS debug adapter, and ubuntu-latest bundles Node 12.16.1. + # We can remove this when we switch over to the python-based DA in https://github.com/microsoft/vscode-python/issues/7136. + # See https://github.com/microsoft/ptvsd/issues/2068 + # At this point pinning is only needed for consistency. We no longer have TS debug adapter. + NODE_VERSION: 12.15.0 + # Force a path with spaces and unicode to test extension works in these scenarios special-working-directory: './path with chars Ⓛ' special-working-directory-relative: 'path with chars Ⓛ' defaults: run: - # Force a path with spaces and unicode to test extension works in these scenarios working-directory: ${{env.special-working-directory}} if: github.repository == 'microsoft/vscode-python' strategy: @@ -138,12 +143,6 @@ jobs: # Run the tests on the oldest and most recent versions of Python. python: [2.7, 3.8] test-suite: [ts-unit, python-unit, venv, single-workspace, multi-workspace, debugger, functional] - env: - # Something in Node 12.16.0 breaks the TS debug adapter, and ubuntu-latest bundles Node 12.16.1. - # We can remove this when we switch over to the python-based DA in https://github.com/microsoft/vscode-python/issues/7136. - # See https://github.com/microsoft/ptvsd/issues/2068 - # At this point pinning is only needed for consistency. We no longer have TS debug adapter. - NODE_VERSION: 12.15.0 steps: - name: Checkout uses: actions/checkout@v2 From 3c4bc0afea60582fbbd9a85eaea8c5a344efc9a9 Mon Sep 17 00:00:00 2001 From: rchiodo Date: Mon, 28 Sep 2020 16:22:21 -0700 Subject: [PATCH 14/19] Pass parameters correctly --- .github/workflows/insiders.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/insiders.yml b/.github/workflows/insiders.yml index 645d9e0041ef..6d358d5c85db 100644 --- a/.github/workflows/insiders.yml +++ b/.github/workflows/insiders.yml @@ -146,7 +146,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@v2 - path: ${{env.special-working-directory-relative}} + with: + path: ${{env.special-working-directory-relative}} - name: Cache pip files uses: actions/cache@v2 From 3e9a19ea9bae00fda4d6e25e12369aa62d814524 Mon Sep 17 00:00:00 2001 From: rchiodo Date: Mon, 28 Sep 2020 16:40:50 -0700 Subject: [PATCH 15/19] Try without unicode --- .github/workflows/insiders.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/insiders.yml b/.github/workflows/insiders.yml index 6d358d5c85db..a2f5e337b0b6 100644 --- a/.github/workflows/insiders.yml +++ b/.github/workflows/insiders.yml @@ -127,9 +127,10 @@ jobs: # See https://github.com/microsoft/ptvsd/issues/2068 # At this point pinning is only needed for consistency. We no longer have TS debug adapter. NODE_VERSION: 12.15.0 - # Force a path with spaces and unicode to test extension works in these scenarios - special-working-directory: './path with chars Ⓛ' - special-working-directory-relative: 'path with chars Ⓛ' + # Force a path with spaces and to test extension works in these scenarios + # Unicode characters are causing 2.7 failures so skip that for now. + special-working-directory: './path with spaces' + special-working-directory-relative: 'path with spaces' defaults: run: working-directory: ${{env.special-working-directory}} From 70b7c3191083233e2e8a161c10762e3b404e2d36 Mon Sep 17 00:00:00 2001 From: rchiodo Date: Mon, 28 Sep 2020 16:49:40 -0700 Subject: [PATCH 16/19] Set working directory directly on xvfb actions --- .github/workflows/insiders.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/insiders.yml b/.github/workflows/insiders.yml index a2f5e337b0b6..ac6596124a9d 100644 --- a/.github/workflows/insiders.yml +++ b/.github/workflows/insiders.yml @@ -325,6 +325,7 @@ jobs: uses: GabrielBB/xvfb-action@v1.4 with: run: npm run testSingleWorkspace + workingDirectory: ${{env.special-working-directory}} if: matrix.test-suite == 'venv' - name: Run single-workspace tests @@ -333,6 +334,7 @@ jobs: uses: GabrielBB/xvfb-action@v1.4 with: run: npm run testSingleWorkspace + workingDirectory: ${{env.special-working-directory}} if: matrix.test-suite == 'single-workspace' - name: Run multi-workspace tests @@ -341,6 +343,7 @@ jobs: uses: GabrielBB/xvfb-action@v1.4 with: run: npm run testMultiWorkspace + workingDirectory: ${{env.special-working-directory}} if: matrix.test-suite == 'multi-workspace' - name: Run debugger tests @@ -349,6 +352,7 @@ jobs: uses: GabrielBB/xvfb-action@v1.4 with: run: npm run testDebugger + workingDirectory: ${{env.special-working-directory}} if: matrix.test-suite == 'debugger' - name: Run functional tests From 46584e967de11b8edea724c310f9ebf586090bfa Mon Sep 17 00:00:00 2001 From: rchiodo Date: Mon, 28 Sep 2020 16:54:18 -0700 Subject: [PATCH 17/19] Working-directory not workingDirectory --- .github/workflows/insiders.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/insiders.yml b/.github/workflows/insiders.yml index ac6596124a9d..4c5229c2365b 100644 --- a/.github/workflows/insiders.yml +++ b/.github/workflows/insiders.yml @@ -325,7 +325,7 @@ jobs: uses: GabrielBB/xvfb-action@v1.4 with: run: npm run testSingleWorkspace - workingDirectory: ${{env.special-working-directory}} + working-directory: ${{env.special-working-directory}} if: matrix.test-suite == 'venv' - name: Run single-workspace tests @@ -334,7 +334,7 @@ jobs: uses: GabrielBB/xvfb-action@v1.4 with: run: npm run testSingleWorkspace - workingDirectory: ${{env.special-working-directory}} + working-directory: ${{env.special-working-directory}} if: matrix.test-suite == 'single-workspace' - name: Run multi-workspace tests @@ -343,7 +343,7 @@ jobs: uses: GabrielBB/xvfb-action@v1.4 with: run: npm run testMultiWorkspace - workingDirectory: ${{env.special-working-directory}} + working-directory: ${{env.special-working-directory}} if: matrix.test-suite == 'multi-workspace' - name: Run debugger tests @@ -352,7 +352,7 @@ jobs: uses: GabrielBB/xvfb-action@v1.4 with: run: npm run testDebugger - workingDirectory: ${{env.special-working-directory}} + working-directory: ${{env.special-working-directory}} if: matrix.test-suite == 'debugger' - name: Run functional tests From 7fd5715e2a15780b38bdbd634e85ac8319a00ae1 Mon Sep 17 00:00:00 2001 From: rchiodo Date: Mon, 28 Sep 2020 17:12:02 -0700 Subject: [PATCH 18/19] Cached ts files output --- .github/workflows/insiders.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/insiders.yml b/.github/workflows/insiders.yml index 4c5229c2365b..f790f85e4e59 100644 --- a/.github/workflows/insiders.yml +++ b/.github/workflows/insiders.yml @@ -167,7 +167,7 @@ jobs: id: out-cache uses: actions/cache@v2 with: - path: ./out + path: ${{env.special-working-directory}}/out key: ${{runner.os}}-${{env.CACHE_OUT_DIRECTORY}}-${{hashFiles('src/**')}} - name: Install dependencies (npm ci) From 47c6c9cdc3afadcc25521891442236eb9cea3e54 Mon Sep 17 00:00:00 2001 From: rchiodo Date: Tue, 6 Oct 2020 14:39:47 -0700 Subject: [PATCH 19/19] Remove test with space branch for insiders --- .github/workflows/insiders.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/insiders.yml b/.github/workflows/insiders.yml index a43598d005c4..77b7fa3c9091 100644 --- a/.github/workflows/insiders.yml +++ b/.github/workflows/insiders.yml @@ -4,7 +4,6 @@ on: push: branches: - main - - rchiodo/test_with_space env: PYTHON_VERSION: 3.8