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.

tests: fix missing index.html (#8642)

Myles Scolnick15507dd76613
diff --git a/.github/workflows/test_be.yaml b/.github/workflows/test_be.yaml
index 8bd5d6624e..dcaa27d9dd 100644
--- a/.github/workflows/test_be.yaml
+++ b/.github/workflows/test_be.yaml
@@ -182,6 +182,8 @@ jobs:
fi
# Test with base dependencies
+ # Exit code 5 = no tests collected (e.g. only CLI test files changed);
+ # treat that as success since CLI tests run in a separate workflow.
- name: Test changed with base dependencies
if: ${{ matrix.dependencies == 'core' }}
run: |
@@ -192,7 +194,8 @@ jobs:
-p packages.pytest_changed \
--changed-from=${{ steps.setup-flags.outputs.changed_from }} \
--include-unchanged=${{ steps.setup-flags.outputs.include_unchanged }} \
- --picked=first
+ --picked=first \
+ || { ec=$?; [ $ec -eq 5 ] && exit 0 || exit $ec; }
# Test with optional dependencies
- name: Test changed with optional dependencies
@@ -205,7 +208,8 @@ jobs:
-p packages.pytest_changed \
--changed-from=${{ steps.setup-flags.outputs.changed_from }} \
--include-unchanged=${{ steps.setup-flags.outputs.include_unchanged }} \
- --picked=first
+ --picked=first \
+ || { ec=$?; [ $ec -eq 5 ] && exit 0 || exit $ec; }
# Test with minimal dependencies using lowest resolution
# https://docs.astral.sh/uv/concepts/resolution/#lowest-resolution
@@ -220,7 +224,8 @@ jobs:
-p packages.pytest_changed \
--changed-from=${{ steps.setup-flags.outputs.changed_from }} \
--include-unchanged=${{ steps.setup-flags.outputs.include_unchanged }} \
- --picked=first
+ --picked=first \
+ || { ec=$?; [ $ec -eq 5 ] && exit 0 || exit $ec; }
env:
UV_RESOLUTION: lowest
diff --git a/tests/_cli/test_cli_export.py b/tests/_cli/test_cli_export.py
index 03f7b1afe4..0db7df2426 100644
--- a/tests/_cli/test_cli_export.py
+++ b/tests/_cli/test_cli_export.py
@@ -22,6 +22,7 @@ from marimo._cli.export.commands import pdf
from marimo._dependencies.dependencies import DependencyManager
from marimo._session.state.serialize import get_session_cache_file
from marimo._utils import async_path
+from marimo._utils.paths import marimo_package_path
from marimo._utils.platform import is_windows
from tests._server.templates.utils import normalize_index_html
from tests.mocks import (
@@ -38,6 +39,22 @@ if TYPE_CHECKING:
HAS_UV = DependencyManager.which("uv")
snapshot = snapshotter(__file__)
+# The in-process CliRunner imports marimo from whatever location Python
+# resolves (source tree locally, installed wheel in CI). The exporter reads
+# index.html from marimo_package_path() / "_static", so ensure it exists
+# there. Copy the test-fixture index.html if it's missing.
+_STATIC_INDEX = (marimo_package_path() / "_static" / "index.html").resolve()
+if not _STATIC_INDEX.exists():
+ _STATIC_INDEX.parent.mkdir(parents=True, exist_ok=True)
+ _test_index = (
+ Path(__file__).resolve().parents[1]
+ / "_server"
+ / "templates"
+ / "data"
+ / "index.html"
+ )
+ shutil.copy(_test_index, _STATIC_INDEX)
+
def _is_win32() -> bool:
return sys.platform == "win32"