Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

1.1 KB
Raw Blame
from __future__ import annotations

import pytest

from tests.mocks import snapshotter

snapshot = snapshotter(__file__)


def test_required_dependencies(pyproject_text: str) -> None:
    import tomlkit

    pyproject = tomlkit.loads(pyproject_text)
    deps = sorted(pyproject["project"]["dependencies"])
    snapshot("dependencies.txt", "\n".join(deps), keep_version=True)


def test_pyzmq_is_a_required_dependency(pyproject_text: str) -> None:
    """Kernel IPC imports zmq without a runtime check; sandbox code may
    assume it is present wherever marimo is."""
    import tomlkit

    pyproject = tomlkit.loads(pyproject_text)
    deps = pyproject["project"]["dependencies"]
    assert any(str(dep).startswith("pyzmq") for dep in deps)


@pytest.mark.parametrize(
    "extra",
    ["sql", "sandbox", "recommended", "lsp", "mcp"],
)
def test_optional_dependencies(extra: str, pyproject_text: str) -> None:
    import tomlkit

    pyproject = tomlkit.loads(pyproject_text)
    deps = sorted(pyproject["project"]["optional-dependencies"][extra])
    snapshot(
        f"optional-dependencies-{extra}.txt",
        "\n".join(deps),
        keep_version=True,
    )