Skip to content

Commit

Permalink
backport repo checks from jupyterlite#27
Browse files Browse the repository at this point in the history
  • Loading branch information
bollwyvl committed Mar 31, 2023
1 parent 06e09a0 commit cfa20b8
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions jupyterlite_pyodide_kernel/tests/test_repo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
"""Validate the integrity of the repo (or source checkout)"""
import json
from pathlib import Path

import pytest
from jupyterlite_core.constants import UTF8

from jupyterlite_pyodide_kernel.constants import PYODIDE_VERSION

from .conftest import HERE

PACKAGES = HERE / "../../packages"
KERNEL_PKG = PACKAGES / "pyodide-kernel"
KERNEL_PKG_JSON = KERNEL_PKG / "package.json"

if not KERNEL_PKG_JSON.exists(): # pragma: no cover
pytest.skip(
"not in a source checkout, skipping repo tests", allow_module_level=True
)


def test_pyodide_version():
kernel_pkg_data = json.loads(KERNEL_PKG_JSON.read_text(**UTF8))
assert (
kernel_pkg_data["devDependencies"]["pyodide"] == PYODIDE_VERSION
), f"{kernel_pkg_data} pyodide devDependency is not {PYODIDE_VERSION}"


@pytest.fixture
def the_default_pyodide_url():
return f"https://cdn.jsdelivr.net/pyodide/v{PYODIDE_VERSION}/full/pyodide.js"


@pytest.mark.parametrize(
"pkg_path",
[
"pyodide-kernel-extension/schema/kernel.v0.schema.json",
"pyodide-kernel-extension/src/index.ts",
],
)
def test_pyodide_url(pkg_path: Path, the_default_pyodide_url: str):
assert the_default_pyodide_url in (PACKAGES / pkg_path).read_text(**UTF8)

0 comments on commit cfa20b8

Please sign in to comment.