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
fix: unit test for markdown export (#1947)
Mut Ze7e53f4408c4c
diff --git a/.github/workflows/test_cli.yaml b/.github/workflows/test_cli.yamlindex e644d2a194..80c71689d8 100644--- a/.github/workflows/test_cli.yaml+++ b/.github/workflows/test_cli.yaml@@ -91,7 +91,7 @@ jobs:- name: Install Python depsrun: |python -m pip install --upgrade pip- pip install pytest+ pip install pytest pytest-asyncio- name: Download wheeluses: actions/download-artifact@v3diff --git a/tests/_cli/test_cli_export.py b/tests/_cli/test_cli_export.pyindex a7a0db3aff..3637e563e4 100644--- a/tests/_cli/test_cli_export.py+++ b/tests/_cli/test_cli_export.py@@ -340,7 +340,7 @@ class TestExportMarkdown:snapshot("markdown.txt", output)@staticmethod- def test_export_script_async(temp_async_marimo_file: str) -> None:+ def test_export_markdown_async(temp_async_marimo_file: str) -> None:p = subprocess.run(["marimo", "export", "md", temp_async_marimo_file],capture_output=True,@@ -351,7 +351,7 @@ class TestExportMarkdown:snapshot("async.txt", output)@staticmethod- def test_export_broken(temp_unparsable_marimo_file: str) -> None:+ def test_export_markdown_broken(temp_unparsable_marimo_file: str) -> None:p = subprocess.run(["marimo", "export", "md", temp_unparsable_marimo_file],capture_output=True,@@ -365,8 +365,8 @@ class TestExportMarkdown:condition=DependencyManager.has_watchdog(),reason="hangs when watchdog is installed",)- async def test_export_watch_script(self, temp_marimo_file: str) -> None:- temp_out_file = temp_marimo_file.replace(".md", ".script.md")+ async def test_export_watch_markdown(self, temp_marimo_file: str) -> None:+ temp_out_file = temp_marimo_file.replace(".py", ".md")p = subprocess.Popen( # noqa: ASYNC101 ASYNC220["marimo",@@ -409,7 +409,7 @@ class TestExportMarkdown:condition=DependencyManager.has_watchdog(),reason="hangs when watchdog is installed",)- def test_export_watch_script_no_out_dir(+ def test_export_watch_markdown_no_out_dir(self, temp_marimo_file: str) -> None:p = subprocess.Popen(diff --git a/tests/conftest.py b/tests/conftest.pyindex 86599807db..acc07b4918 100644--- a/tests/conftest.py+++ b/tests/conftest.py@@ -3,6 +3,7 @@ from __future__ import annotationsimport dataclassesimport inspect+import osimport sysimport textwrapfrom tempfile import TemporaryDirectory@@ -188,7 +189,7 @@ def executing_kernel() -> Generator[Kernel, None, None]:@pytest.fixturedef temp_marimo_file() -> Generator[str, None, None]:tmp_dir = TemporaryDirectory()- tmp_file = tmp_dir.name + "/notebook.py"+ tmp_file = os.path.join(tmp_dir.name, "notebook.py")content = inspect.cleandoc("""import marimo@@ -220,7 +221,7 @@ def temp_marimo_file() -> Generator[str, None, None]:@pytest.fixturedef temp_async_marimo_file() -> Generator[str, None, None]:tmp_dir = TemporaryDirectory()- tmp_file = tmp_dir.name + "/notebook.py"+ tmp_file = os.path.join(tmp_dir.name, "notebook.py")content = inspect.cleandoc("""import marimo@@ -249,7 +250,7 @@ def temp_async_marimo_file() -> Generator[str, None, None]:@pytest.fixturedef temp_unparsable_marimo_file() -> Generator[str, None, None]:tmp_dir = TemporaryDirectory()- tmp_file = tmp_dir.name + "/notebook.py"+ tmp_file = os.path.join(tmp_dir.name, "notebook.py")content = inspect.cleandoc("""import marimo@@ -291,7 +292,7 @@ def temp_unparsable_marimo_file() -> Generator[str, None, None]:@pytest.fixturedef temp_marimo_file_with_md() -> Generator[str, None, None]:tmp_dir = TemporaryDirectory()- tmp_file = tmp_dir.name + "/notebook.py"+ tmp_file = os.path.join(tmp_dir.name, "notebook.py")content = inspect.cleandoc("""import marimo@@ -331,7 +332,7 @@ def temp_marimo_file_with_md() -> Generator[str, None, None]:@pytest.fixturedef temp_md_marimo_file() -> Generator[str, None, None]:tmp_dir = TemporaryDirectory()- tmp_file = tmp_dir.name + "/notebook.md"+ tmp_file = os.path.join(tmp_dir.name, "notebook.md")content = inspect.cleandoc("""---