Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion sqlmesh/core/config/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,8 @@ def load_config_from_python_module(

if config_obj is None or not isinstance(config_obj, Config):
raise ConfigError(
f"Config needs to be a valid object of type sqlmesh.core.config.Config. Found `{config_obj}` instead at '{module_path}'."
f"Config needs to be a valid object of type sqlmesh.core.config.Config. Found `{config_obj}` instead at '{module_path}'.",
module_path,
)

return (
Expand Down
42 changes: 42 additions & 0 deletions vscode/extension/tests/broken_project.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -358,4 +358,46 @@ test.describe('Bad config.py/config.yaml file issues', () => {
.first()
.isVisible({ timeout: 5_000 })
})

test('sushi example, correct python, bad config', async ({
page,
sharedCodeServer,
}) => {
const tempDir = await fs.mkdtemp(
path.join(os.tmpdir(), 'vscode-test-tcloud-'),
)
await fs.copy(SUSHI_SOURCE_PATH, tempDir)
await createPythonInterpreterSettingsSpecifier(tempDir)

const configPyPath = path.join(tempDir, 'config.py')
// Write an invalid Python to config.py
await fs.writeFile(configPyPath, 'config = {}')

await page.goto(
`http://127.0.1:${sharedCodeServer.codeServerPort}/?folder=${tempDir}`,
)
await page.waitForLoadState('networkidle')

// Open customers.sql model
await page
.getByRole('treeitem', { name: 'models', exact: true })
.locator('a')
.click()
await page
.getByRole('treeitem', { name: 'customers.sql', exact: true })
.locator('a')
.click()

// Expect the error to appear
await page.waitForSelector('text=Error creating context')

// Open the problems view
await runCommand(page, 'View: Focus Problems')

// Assert that the error is present in the problems view
await page
.getByText('Config needs to be a valid object of type')
.first()
.isVisible({ timeout: 5_000 })
})
})