Skip to content

Commit 4316e49

Browse files
authored
chore(vscode): test .env virtual environmnet (#4858)
1 parent 2c828b3 commit 4316e49

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import { test } from '@playwright/test'
2+
import fs from 'fs-extra'
3+
import os from 'os'
4+
import path from 'path'
5+
import {
6+
createVirtualEnvironment,
7+
openLineageView,
8+
pipInstall,
9+
REPO_ROOT,
10+
SUSHI_SOURCE_PATH,
11+
} from './utils'
12+
import { startCodeServer, stopCodeServer } from './utils_code_server'
13+
14+
test('venv being named .env', async ({ page }, testInfo) => {
15+
testInfo.setTimeout(120_000) // 2 minutes for venv creation and package installation
16+
const tempDir = await fs.mkdtemp(
17+
path.join(os.tmpdir(), 'vscode-test-tcloud-'),
18+
)
19+
20+
const pythonEnvDir = path.join(tempDir, '.env')
21+
const pythonDetails = await createVirtualEnvironment(pythonEnvDir)
22+
const custom_materializations = path.join(
23+
REPO_ROOT,
24+
'examples',
25+
'custom_materializations',
26+
)
27+
const sqlmeshWithExtras = `${REPO_ROOT}[bigquery,lsp]`
28+
await pipInstall(pythonDetails, [sqlmeshWithExtras, custom_materializations])
29+
await fs.copy(SUSHI_SOURCE_PATH, tempDir)
30+
31+
const settings = {
32+
'python.defaultInterpreterPath': pythonDetails.pythonPath,
33+
}
34+
await fs.ensureDir(path.join(tempDir, '.vscode'))
35+
await fs.writeJson(path.join(tempDir, '.vscode', 'settings.json'), settings, {
36+
spaces: 2,
37+
})
38+
39+
const context = await startCodeServer({ tempDir })
40+
41+
try {
42+
await page.goto(`http://127.0.0.1:${context.codeServerPort}`)
43+
await openLineageView(page)
44+
await page.waitForSelector('text=Loaded SQLMesh Context')
45+
} finally {
46+
await stopCodeServer(context)
47+
}
48+
})

0 commit comments

Comments
 (0)