-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: marimoPath usage, more integration tests (#72)
* fix: marimoPath usage, more integration tests * test * install * fix commend regex
- Loading branch information
Showing
21 changed files
with
508 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
name: CI | ||
|
||
env: | ||
MARIMO_SKIP_UPDATE_CHECK: true | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
|
@@ -58,3 +61,41 @@ jobs: | |
|
||
- name: ʦ Typecheck | ||
run: pnpm typecheck | ||
|
||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: 🛑 Cancel Previous Runs | ||
uses: styfle/[email protected] | ||
|
||
- name: ⬇️ Checkout repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: ⎔ Setup pnpm | ||
uses: pnpm/action-setup@v2 | ||
with: | ||
version: 8 | ||
|
||
- name: 🐍 Setup uv | ||
uses: astral-sh/setup-uv@v5 | ||
|
||
- name: 🐍 Setup Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.12 | ||
|
||
- name: ⎔ Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
cache: pnpm | ||
|
||
- name: 📥 Install dependencies | ||
run: | | ||
uv pip install marimo --system | ||
pnpm install | ||
- name: 🧪 Run tests | ||
run: pnpm test | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import { beforeEach, describe, expect, it, vi } from "vitest"; | ||
import { createVSCodeMock } from "../__mocks__/vscode"; | ||
|
||
vi.mock("vscode", () => createVSCodeMock(vi)); | ||
vi.mock("@vscode/python-extension", () => ({})); | ||
|
||
import { workspace } from "vscode"; | ||
import { execMarimoCommand, execPythonModule } from "../utils/exec"; | ||
|
||
beforeEach(() => { | ||
workspace.getConfiguration().reset(); | ||
}); | ||
|
||
describe("execMarimoCommand integration tests", () => { | ||
it("should work out of the box", async () => { | ||
const output = await execMarimoCommand(["--version"]); | ||
expect(output.toString()).toMatch(/\d+\.\d+\.\d+/); | ||
}); | ||
|
||
it.each(["python", "uv run python"])( | ||
"should run marimo --version with %s", | ||
async (interpreter) => { | ||
workspace.getConfiguration().set("marimo.pythonPath", interpreter); | ||
const output = await execMarimoCommand(["--version"]); | ||
expect(output.toString()).toMatch(/\d+\.\d+\.\d+/); | ||
}, | ||
); | ||
|
||
it.each(["uv run marimo", "uvx marimo", "uv tool run marimo"])( | ||
"should run marimo --version with %s", | ||
async (interpreter) => { | ||
workspace.getConfiguration().set("marimo.marimoPath", interpreter); | ||
const output = await execMarimoCommand(["--version"]); | ||
expect(output.toString()).toMatch(/\d+\.\d+\.\d+/); | ||
}, | ||
); | ||
|
||
it("path path gets overridden by marimoPath", async () => { | ||
workspace.getConfiguration().set("marimo.pythonPath", "doesnotexist"); | ||
expect(() => execMarimoCommand(["--version"])).rejects.toThrow( | ||
/doesnotexist/, | ||
); | ||
|
||
workspace.getConfiguration().set("marimo.marimoPath", "uv run marimo"); | ||
const output = await execMarimoCommand(["--version"]); | ||
expect(output.toString()).toMatch(/\d+\.\d+\.\d+/); | ||
}); | ||
}); | ||
|
||
describe("execPythonModule integration tests", () => { | ||
it("should work out of the box", async () => { | ||
const output = await execPythonModule(["marimo", "--version"]); | ||
expect(output.toString()).toMatch(/\d+\.\d+\.\d+/); | ||
}); | ||
|
||
it.each(["python", "uv run python"])( | ||
"should run python -m marimo --version with %s", | ||
async (interpreter) => { | ||
workspace.getConfiguration().set("marimo.pythonPath", interpreter); | ||
const output = await execPythonModule(["marimo", "--version"]); | ||
expect(output.toString()).toMatch(/\d+\.\d+\.\d+/); | ||
}, | ||
); | ||
}); |
Oops, something went wrong.