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.
Python artificial-intelligencedagdata-sciencedata-visualizationdataflowdeveloper-toolsmachine-learningnotebookspipelinepythonreactivesqlweb-app
tests fix test_cli_with_custom_pyproject_config (#8991)
Myles Scolnick2af199e2997d
diff --git a/frontend/src/plugins/impl/plotly/selection.ts b/frontend/src/plugins/impl/plotly/selection.tsindex db12b9c3d4..92951a4e29 100644--- a/frontend/src/plugins/impl/plotly/selection.ts+++ b/frontend/src/plugins/impl/plotly/selection.ts@@ -15,10 +15,7 @@ export interface PlotlyClickSelection {selections: unknown[];}-const CLICK_SELECTABLE_TRACE_TYPES = new Set([- "heatmap",- "histogram",-]);+const CLICK_SELECTABLE_TRACE_TYPES = new Set(["heatmap", "histogram"]);const STANDARD_POINT_KEYS: string[] = ["x",diff --git a/tests/_cli/test_cli.py b/tests/_cli/test_cli.pyindex 3575a45b61..4c7b5b2201 100644--- a/tests/_cli/test_cli.py+++ b/tests/_cli/test_cli.py@@ -23,10 +23,16 @@ from typing import TYPE_CHECKING, Any, Callable, Optionalfrom unittest.mock import patchimport pytest+from click.testing import CliRunnerfrom marimo._ast import codegenfrom marimo._ast.cell import CellConfig-from marimo._cli.cli import _collect_marimo_files, _create_run_file_router+from marimo._cli.cli import (+ _collect_marimo_files,+ _create_run_file_router,+ main as cli_main,+)+from marimo._config.manager import get_default_config_managerfrom marimo._dependencies.dependencies import DependencyManagerfrom marimo._server.file_router import (LazyListOfFilesAppFileRouter,@@ -1607,7 +1613,6 @@ def test_cli_run_sandbox_prompt_yes() -> None:p.kill()[email protected](not HAS_UV, reason="uv is required for sandbox tests")def test_cli_with_custom_pyproject_config(tmp_path: Path) -> None:# Create a custom pyproject.toml with special marimo configpyproject_path = tmp_path / "pyproject.toml"@@ -1625,35 +1630,32 @@ def test_cli_with_custom_pyproject_config(tmp_path: Path) -> None:marimo_file = tmp_path / "tmp.py"- # marimo edit <marimo_file> --sandbox- port = _get_port()- p = subprocess.Popen(- [- "marimo",- "edit",- str(marimo_file),- "--sandbox",- "-p",- str(port),- "--headless",- "--no-token",- ],- )+ runner = CliRunner()- def assert_custom_config(contents: bytes | None) -> None:- assert contents is not None- # Verify that the custom config is applied- assert b'"line_length": 111' in contents- assert b'"auto_instantiate": false' in contents- # Verify that the package manager is switch to uv because we are running in a sandbox- # TODO: fix this, it does not get overridden in tests (maybe it is using a different marimo version that the one in CI)- # assert b'"manager": "uv"' in contents+ with (+ patch(+ "marimo._cli.cli.prompt_run_in_docker_container",+ return_value=False,+ ),+ patch(+ "marimo._utils.platform.check_shared_memory_available",+ return_value=(True, None),+ ),+ patch("marimo._cli.cli.start"),+ ):+ result = runner.invoke(+ cli_main,+ ["edit", str(marimo_file), "--headless", "--no-token"],+ )- try:- contents = _try_fetch(port)- assert_custom_config(contents)- finally:- p.kill()+ assert result.exit_code == 0, result.output++ # Verify that the custom config from pyproject.toml is loaded+ config_manager = get_default_config_manager(current_path=str(marimo_file))+ config = config_manager.get_config()+ assert config["formatting"]["line_length"] == 111+ assert config["runtime"]["auto_instantiate"] is False+ assert config["package_management"]["manager"] == "pip"# Test sandbox with config for vscode compatibility