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.

Refactor tests into their own directory (#491)

Akshay Agrawalfc984bb82725
diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml
index 8af0686c3b..8c702d7572 100644
--- a/.github/workflows/test.yaml
+++ b/.github/workflows/test.yaml
@@ -94,4 +94,9 @@ jobs:
mypy --config-file pyproject.toml marimo/
- name: Test
run: |
- pytest -v marimo/ -k "not test_cli"
+ pytest -v tests/ -k "not test_cli" --cov=marimo --cov-branch
+ - name: Upload coverage reports to Codecov
+ if: ${{ matrix.python-version == '3.11' && matrix.os == 'ubuntu-latest' }}
+ uses: codecov/codecov-action@v3
+ env:
+ CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
diff --git a/.github/workflows/test_cli.yaml b/.github/workflows/test_cli.yaml
index 23ac9be3e0..40304056ec 100644
--- a/.github/workflows/test_cli.yaml
+++ b/.github/workflows/test_cli.yaml
@@ -86,4 +86,4 @@ jobs:
- name: Test CLI
shell: bash
- run: pytest -v marimo/_cli/test_cli.py
+ run: pytest -v tests/_cli/test_cli.py
diff --git a/pyproject.toml b/pyproject.toml
index e879cee1ef..7a3bf63472 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -62,6 +62,7 @@ dev = [
# have the rust toolchain installed on CI
"polars==0.19.12",
"pytest~=7.4.0",
+ "pytest-codecov~=0.5.1",
"mypy~=1.7.0",
"ruff~=0.0.275",
# For docs
@@ -94,6 +95,8 @@ exclude = [
"marimo/_smoke_tests",
"marimo/_test_utils/codegen_data",
"marimo/_test_utils/_tutorials",
+ "tests/_ast/codegen_data",
+ "tests/_cli/ipynb_data",
"frontend",
"docs",
"build",
@@ -118,8 +121,6 @@ select = [
"FA102",
# isort
"I001",
- # copyright notice
- "CPY001",
]
# Never try to fix `F401` (unused imports).
@@ -133,8 +134,8 @@ line-length = 79
extend-exclude = """
(
^/examples/*
- | ^/marimo/_test_utils/codegen_data/*
- | ^/marimo/_test_utils/ipynb_data/*
+ | ^/tests/_ast/codegen_data/*
+ | ^/tests/_cli/ipynb_data/*
| ^/marimo/_tutorials/*
| ^/marimo/_smoke_tests/*
)
@@ -144,8 +145,8 @@ extend-exclude = """
strict = true
exclude = [
'examples',
- 'marimo/_test_utils/codegen_data',
- 'marimo/_test_utils/ipynb_data',
+ 'tests/_ast/codegen_data',
+ 'tests/_cli/ipynb_data',
'marimo/_tutorials/',
'marimo/_smoke_tests/',
]
@@ -158,7 +159,7 @@ ignore_errors = true
[tool.pytest.ini_options]
minversion = "6.0"
-addopts = "-ra -q -v --ignore marimo/_test_utils/"
+addopts = "-ra -q -v --ignore tests/_cli/ipynb_data --ignore tests/_ast/codegen_data"
testpaths = [
- "marimo",
+ "tests",
]
diff --git a/scripts/pycopyright.sh b/scripts/pycopyright.sh
index d256651274..f6a0ddf6cf 100755
--- a/scripts/pycopyright.sh
+++ b/scripts/pycopyright.sh
@@ -1,19 +1,12 @@
#!/bin/bash
-# Directory to scan
+# Directories to scan
dir="marimo"
# Counter for updated files
count=0
-# Check if directory exists
-if [[ ! -d "$dir" ]]; then
- echo "Directory does not exist."
- exit 1
-fi
-
-# Iterate over each Python file excluding "_test_utils" subdirectory, which
-# contains data files for tests
+# Iterate over each Python file and add copyright notice if it isn't there
while read file
do
# Check if the file does not start with "# Copyright"
@@ -28,7 +21,7 @@ do
mv "$tmp_file" "$file"
((count++))
fi
-done < <(find "$dir" -name "_test_utils" -prune -o -type f -name "*.py" -print)
+done < <(find "$dir" -type f -name "*.py" -print)
if (( count > 0 )); then
echo "$(tput bold)added copyright notices to $count files$(tput sgr0)"
diff --git a/scripts/pyfix.sh b/scripts/pyfix.sh
index f2705e8ca7..5dba8976fe 100755
--- a/scripts/pyfix.sh
+++ b/scripts/pyfix.sh
@@ -4,6 +4,8 @@ echo "[fix: copyright]"
./scripts/pycopyright.sh
echo "[fix: ruff]"
ruff marimo/ --fix
+ruff tests/ --fix
echo "[fix: black]"
black marimo/
+black tests/
./scripts/pycheck.sh
diff --git a/tests/__init__.py b/tests/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/marimo/_test_utils/codegen_data/test_generate_filecontents.py b/tests/_ast/codegen_data/test_generate_filecontents.py
similarity index 100%
rename from marimo/_test_utils/codegen_data/test_generate_filecontents.py
rename to tests/_ast/codegen_data/test_generate_filecontents.py
diff --git a/marimo/_test_utils/codegen_data/test_generate_filecontents_shadowed_builtin.py b/tests/_ast/codegen_data/test_generate_filecontents_shadowed_builtin.py
similarity index 100%
rename from marimo/_test_utils/codegen_data/test_generate_filecontents_shadowed_builtin.py
rename to tests/_ast/codegen_data/test_generate_filecontents_shadowed_builtin.py
diff --git a/marimo/_test_utils/codegen_data/test_generate_filecontents_single_cell.py b/tests/_ast/codegen_data/test_generate_filecontents_single_cell.py
similarity index 100%
rename from marimo/_test_utils/codegen_data/test_generate_filecontents_single_cell.py
rename to tests/_ast/codegen_data/test_generate_filecontents_single_cell.py
diff --git a/marimo/_test_utils/codegen_data/test_generate_filecontents_unshadowed_builtin.py b/tests/_ast/codegen_data/test_generate_filecontents_unshadowed_builtin.py
similarity index 100%
rename from marimo/_test_utils/codegen_data/test_generate_filecontents_unshadowed_builtin.py
rename to tests/_ast/codegen_data/test_generate_filecontents_unshadowed_builtin.py
diff --git a/marimo/_test_utils/codegen_data/test_generate_filecontents_with_syntax_error.py b/tests/_ast/codegen_data/test_generate_filecontents_with_syntax_error.py
similarity index 100%
rename from marimo/_test_utils/codegen_data/test_generate_filecontents_with_syntax_error.py
rename to tests/_ast/codegen_data/test_generate_filecontents_with_syntax_error.py
diff --git a/marimo/_test_utils/codegen_data/test_get_codes_comment_after_sig.py b/tests/_ast/codegen_data/test_get_codes_comment_after_sig.py
similarity index 100%
rename from marimo/_test_utils/codegen_data/test_get_codes_comment_after_sig.py
rename to tests/_ast/codegen_data/test_get_codes_comment_after_sig.py
diff --git a/marimo/_test_utils/codegen_data/test_get_codes_empty.py b/tests/_ast/codegen_data/test_get_codes_empty.py
similarity index 100%
rename from marimo/_test_utils/codegen_data/test_get_codes_empty.py
rename to tests/_ast/codegen_data/test_get_codes_empty.py
diff --git a/marimo/_test_utils/codegen_data/test_get_codes_messy.py b/tests/_ast/codegen_data/test_get_codes_messy.py
similarity index 100%
rename from marimo/_test_utils/codegen_data/test_get_codes_messy.py
rename to tests/_ast/codegen_data/test_get_codes_messy.py
diff --git a/marimo/_test_utils/codegen_data/test_get_codes_multiline_fndef.py b/tests/_ast/codegen_data/test_get_codes_multiline_fndef.py
similarity index 100%
rename from marimo/_test_utils/codegen_data/test_get_codes_multiline_fndef.py
rename to tests/_ast/codegen_data/test_get_codes_multiline_fndef.py
diff --git a/marimo/_test_utils/codegen_data/test_get_codes_multiline_string.py b/tests/_ast/codegen_data/test_get_codes_multiline_string.py
similarity index 100%
rename from marimo/_test_utils/codegen_data/test_get_codes_multiline_string.py
rename to tests/_ast/codegen_data/test_get_codes_multiline_string.py
diff --git a/marimo/_test_utils/codegen_data/test_get_codes_single_line_fn.py b/tests/_ast/codegen_data/test_get_codes_single_line_fn.py
similarity index 100%
rename from marimo/_test_utils/codegen_data/test_get_codes_single_line_fn.py
rename to tests/_ast/codegen_data/test_get_codes_single_line_fn.py
diff --git a/marimo/_test_utils/codegen_data/test_get_codes_with_name_error.py b/tests/_ast/codegen_data/test_get_codes_with_name_error.py
similarity index 100%
rename from marimo/_test_utils/codegen_data/test_get_codes_with_name_error.py
rename to tests/_ast/codegen_data/test_get_codes_with_name_error.py
diff --git a/marimo/_test_utils/codegen_data/test_long_line_in_main.py b/tests/_ast/codegen_data/test_long_line_in_main.py
similarity index 100%
rename from marimo/_test_utils/codegen_data/test_long_line_in_main.py
rename to tests/_ast/codegen_data/test_long_line_in_main.py
diff --git a/marimo/_test_utils/codegen_data/test_main.py b/tests/_ast/codegen_data/test_main.py
similarity index 100%
rename from marimo/_test_utils/codegen_data/test_main.py
rename to tests/_ast/codegen_data/test_main.py
diff --git a/marimo/_ast/test_app.py b/tests/_ast/test_app.py
similarity index 100%
rename from marimo/_ast/test_app.py
rename to tests/_ast/test_app.py
diff --git a/marimo/_ast/test_app_cell.py b/tests/_ast/test_app_cell.py
similarity index 100%
rename from marimo/_ast/test_app_cell.py
rename to tests/_ast/test_app_cell.py
diff --git a/marimo/_ast/test_cell.py b/tests/_ast/test_cell.py
similarity index 100%
rename from marimo/_ast/test_cell.py
rename to tests/_ast/test_cell.py
diff --git a/marimo/_ast/test_codegen.py b/tests/_ast/test_codegen.py
similarity index 97%
rename from marimo/_ast/test_codegen.py
rename to tests/_ast/test_codegen.py
index 038186f913..dc27a9d1e6 100644
--- a/marimo/_ast/test_codegen.py
+++ b/tests/_ast/test_codegen.py
@@ -15,9 +15,7 @@ DIR_PATH = os.path.dirname(os.path.realpath(__file__))
def get_expected_filecontents(name: str) -> str:
- with open(
- os.path.join(DIR_PATH, f"../_test_utils/codegen_data/{name}.py"), "r"
- ) as f:
+ with open(os.path.join(DIR_PATH, f"codegen_data/{name}.py"), "r") as f:
contents = f.read()
lines = contents.split("\n")
break_index = None
@@ -34,7 +32,7 @@ def get_expected_filecontents(name: str) -> str:
def get_filepath(name: str) -> str:
- return os.path.join(DIR_PATH, f"../_test_utils/codegen_data/{name}.py")
+ return os.path.join(DIR_PATH, f"codegen_data/{name}.py")
def generate_filecontents(
@@ -231,7 +229,7 @@ class TestGetCodes:
class TestApp:
@staticmethod
def test_run() -> None:
- import marimo._test_utils.codegen_data.test_main as mod
+ import codegen_data.test_main as mod
outputs, defs = mod.app.run()
assert outputs == (None, "z", None)
diff --git a/marimo/_ast/test_visitor.py b/tests/_ast/test_visitor.py
similarity index 100%
rename from marimo/_ast/test_visitor.py
rename to tests/_ast/test_visitor.py
diff --git a/marimo/_test_utils/ipynb_data/arithmetic.ipynb.txt b/tests/_cli/ipynb_data/arithmetic.ipynb.txt
similarity index 100%
rename from marimo/_test_utils/ipynb_data/arithmetic.ipynb.txt
rename to tests/_cli/ipynb_data/arithmetic.ipynb.txt
diff --git a/marimo/_test_utils/ipynb_data/blank.ipynb.txt b/tests/_cli/ipynb_data/blank.ipynb.txt
similarity index 100%
rename from marimo/_test_utils/ipynb_data/blank.ipynb.txt
rename to tests/_cli/ipynb_data/blank.ipynb.txt
diff --git a/marimo/_test_utils/ipynb_data/markdown.ipynb.txt b/tests/_cli/ipynb_data/markdown.ipynb.txt
similarity index 100%
rename from marimo/_test_utils/ipynb_data/markdown.ipynb.txt
rename to tests/_cli/ipynb_data/markdown.ipynb.txt
diff --git a/marimo/_test_utils/ipynb_data/unparsable.ipynb.txt b/tests/_cli/ipynb_data/unparsable.ipynb.txt
similarity index 100%
rename from marimo/_test_utils/ipynb_data/unparsable.ipynb.txt
rename to tests/_cli/ipynb_data/unparsable.ipynb.txt
diff --git a/marimo/_cli/test_cli.py b/tests/_cli/test_cli.py
similarity index 100%
rename from marimo/_cli/test_cli.py
rename to tests/_cli/test_cli.py
diff --git a/marimo/_cli/test_envinfo.py b/tests/_cli/test_envinfo.py
similarity index 100%
rename from marimo/_cli/test_envinfo.py
rename to tests/_cli/test_envinfo.py
diff --git a/marimo/_cli/test_file_path.py b/tests/_cli/test_file_path.py
similarity index 100%
rename from marimo/_cli/test_file_path.py
rename to tests/_cli/test_file_path.py
diff --git a/marimo/_cli/test_ipynb_to_marimo.py b/tests/_cli/test_ipynb_to_marimo.py
similarity index 96%
rename from marimo/_cli/test_ipynb_to_marimo.py
rename to tests/_cli/test_ipynb_to_marimo.py
index 4091470c0d..ec600fd9d6 100644
--- a/marimo/_cli/test_ipynb_to_marimo.py
+++ b/tests/_cli/test_ipynb_to_marimo.py
@@ -14,7 +14,7 @@ DIR_PATH = os.path.dirname(os.path.realpath(__file__))
def get_codes(ipynb_name: str) -> tuple[Sequence[str], Sequence[str]]:
contents = convert_from_path(
- DIR_PATH + f"/../_test_utils/ipynb_data/{ipynb_name}.ipynb.txt"
+ DIR_PATH + f"/ipynb_data/{ipynb_name}.ipynb.txt"
)
tempfile_name = ""
diff --git a/marimo/_cli/test_upgrade.py b/tests/_cli/test_upgrade.py
similarity index 100%
rename from marimo/_cli/test_upgrade.py
rename to tests/_cli/test_upgrade.py
diff --git a/marimo/_config/test_config.py b/tests/_config/test_config.py
similarity index 100%
rename from marimo/_config/test_config.py
rename to tests/_config/test_config.py
diff --git a/marimo/_messaging/test_ops.py b/tests/_messaging/test_ops.py
similarity index 100%
rename from marimo/_messaging/test_ops.py
rename to tests/_messaging/test_ops.py
diff --git a/marimo/_output/test_builder.py b/tests/_output/test_builder.py
similarity index 100%
rename from marimo/_output/test_builder.py
rename to tests/_output/test_builder.py
diff --git a/marimo/_plugins/core/test_media.py b/tests/_plugins/core/test_media.py
similarity index 100%
rename from marimo/_plugins/core/test_media.py
rename to tests/_plugins/core/test_media.py
diff --git a/marimo/_plugins/core/test_web_component.py b/tests/_plugins/core/test_web_component.py
similarity index 100%
rename from marimo/_plugins/core/test_web_component.py
rename to tests/_plugins/core/test_web_component.py
diff --git a/marimo/_plugins/stateless/status/test_progress.py b/tests/_plugins/stateless/status/test_progress.py
similarity index 100%
rename from marimo/_plugins/stateless/status/test_progress.py
rename to tests/_plugins/stateless/status/test_progress.py
diff --git a/marimo/_plugins/stateless/test_flex.py b/tests/_plugins/stateless/test_flex.py
similarity index 100%
rename from marimo/_plugins/stateless/test_flex.py
rename to tests/_plugins/stateless/test_flex.py
diff --git a/marimo/_runtime/test_image.py b/tests/_plugins/stateless/test_image.py
similarity index 97%
rename from marimo/_runtime/test_image.py
rename to tests/_plugins/stateless/test_image.py
index c952809ab4..ed699e4c1e 100644
--- a/marimo/_runtime/test_image.py
+++ b/tests/_plugins/stateless/test_image.py
@@ -1,8 +1,8 @@
# Copyright 2023 Marimo. All rights reserved.
from marimo._plugins.stateless.image import image
-from marimo._runtime.conftest import ExecReqProvider
from marimo._runtime.context import get_context
from marimo._runtime.runtime import Kernel
+from tests.conftest import ExecReqProvider
def test_image() -> None:
diff --git a/marimo/_runtime/test_ui_element_registration.py b/tests/_plugins/ui/_core/test_ui_element_registration.py
similarity index 95%
rename from marimo/_runtime/test_ui_element_registration.py
rename to tests/_plugins/ui/_core/test_ui_element_registration.py
index 778c5136e9..0a8eb1e3cf 100644
--- a/marimo/_runtime/test_ui_element_registration.py
+++ b/tests/_plugins/ui/_core/test_ui_element_registration.py
@@ -1,9 +1,9 @@
# Copyright 2023 Marimo. All rights reserved.
from __future__ import annotations
-from marimo._runtime.conftest import ExecReqProvider
from marimo._runtime.context import get_context
from marimo._runtime.runtime import Kernel
+from tests.conftest import ExecReqProvider
# TODO: colocate test with UIElementRegistry file; requires refactoring
diff --git a/marimo/_plugins/ui/_impl/dataframes/test_handlers.py b/tests/_plugins/ui/_impl/dataframes/test_handlers.py
similarity index 100%
rename from marimo/_plugins/ui/_impl/dataframes/test_handlers.py
rename to tests/_plugins/ui/_impl/dataframes/test_handlers.py
diff --git a/marimo/_plugins/ui/_impl/dataframes/test_transforms.py b/tests/_plugins/ui/_impl/dataframes/test_transforms.py
similarity index 100%
rename from marimo/_plugins/ui/_impl/dataframes/test_transforms.py
rename to tests/_plugins/ui/_impl/dataframes/test_transforms.py
diff --git a/marimo/_plugins/ui/_impl/test_altair_chart.py b/tests/_plugins/ui/_impl/test_altair_chart.py
similarity index 100%
rename from marimo/_plugins/ui/_impl/test_altair_chart.py
rename to tests/_plugins/ui/_impl/test_altair_chart.py
diff --git a/marimo/_plugins/ui/_impl/test_array.py b/tests/_plugins/ui/_impl/test_array.py
similarity index 100%
rename from marimo/_plugins/ui/_impl/test_array.py
rename to tests/_plugins/ui/_impl/test_array.py
diff --git a/marimo/_plugins/ui/_impl/test_batch.py b/tests/_plugins/ui/_impl/test_batch.py
similarity index 100%
rename from marimo/_plugins/ui/_impl/test_batch.py
rename to tests/_plugins/ui/_impl/test_batch.py
diff --git a/marimo/_plugins/ui/_impl/test_dictionary.py b/tests/_plugins/ui/_impl/test_dictionary.py
similarity index 100%
rename from marimo/_plugins/ui/_impl/test_dictionary.py
rename to tests/_plugins/ui/_impl/test_dictionary.py
diff --git a/marimo/_plugins/ui/_impl/test_input.py b/tests/_plugins/ui/_impl/test_input.py
similarity index 100%
rename from marimo/_plugins/ui/_impl/test_input.py
rename to tests/_plugins/ui/_impl/test_input.py
diff --git a/marimo/_plugins/ui/_impl/test_table.py b/tests/_plugins/ui/_impl/test_table.py
similarity index 97%
rename from marimo/_plugins/ui/_impl/test_table.py
rename to tests/_plugins/ui/_impl/test_table.py
index 6c85197752..2e5b4d2f51 100644
--- a/marimo/_plugins/ui/_impl/test_table.py
+++ b/tests/_plugins/ui/_impl/test_table.py
@@ -7,8 +7,8 @@ from marimo._plugins.ui._impl.table import (
_normalize_data,
)
from marimo._plugins.ui._impl.utils.dataframe import TableData
-from marimo._runtime.conftest import MockedKernel
from marimo._runtime.runtime import ExecutionContext
+from tests.conftest import MockedKernel
def test_normalize_data() -> None:
diff --git a/marimo/_plugins/ui/_impl/utils/test_dataframe.py b/tests/_plugins/ui/_impl/utils/test_dataframe.py
similarity index 100%
rename from marimo/_plugins/ui/_impl/utils/test_dataframe.py
rename to tests/_plugins/ui/_impl/utils/test_dataframe.py
diff --git a/marimo/_runtime/output/test_output.py b/tests/_runtime/output/test_output.py
similarity index 93%
rename from marimo/_runtime/output/test_output.py
rename to tests/_runtime/output/test_output.py
index 644b54f8f2..f7f383d32b 100644
--- a/marimo/_runtime/output/test_output.py
+++ b/tests/_runtime/output/test_output.py
@@ -1,7 +1,7 @@
# Copyright 2023 Marimo. All rights reserved.
from __future__ import annotations
-from marimo._runtime.conftest import ExecReqProvider, MockedKernel
+from tests.conftest import ExecReqProvider, MockedKernel
def test_spinner_removed(
diff --git a/marimo/_runtime/test_capture.py b/tests/_runtime/test_capture.py
similarity index 98%
rename from marimo/_runtime/test_capture.py
rename to tests/_runtime/test_capture.py
index 78c2e2d07e..e8e325e098 100644
--- a/marimo/_runtime/test_capture.py
+++ b/tests/_runtime/test_capture.py
@@ -4,7 +4,7 @@ from __future__ import annotations
import re
from typing import Any, Dict, Tuple
-from marimo._runtime.conftest import ExecReqProvider, MockedKernel
+from tests.conftest import ExecReqProvider, MockedKernel
def _has_output(
diff --git a/marimo/_runtime/test_cell_runner.py b/tests/_runtime/test_cell_runner.py
similarity index 90%
rename from marimo/_runtime/test_cell_runner.py
rename to tests/_runtime/test_cell_runner.py
index 7e687061ee..9687e2064c 100644
--- a/marimo/_runtime/test_cell_runner.py
+++ b/tests/_runtime/test_cell_runner.py
@@ -1,7 +1,7 @@
# Copyright 2023 Marimo. All rights reserved.
from marimo._runtime.cell_runner import Runner
-from marimo._runtime.conftest import ExecReqProvider
from marimo._runtime.runtime import Kernel
+from tests.conftest import ExecReqProvider
def test_cell_output(k: Kernel, exec_req: ExecReqProvider) -> None:
diff --git a/marimo/_runtime/test_control_flow.py b/tests/_runtime/test_control_flow.py
similarity index 100%
rename from marimo/_runtime/test_control_flow.py
rename to tests/_runtime/test_control_flow.py
diff --git a/marimo/_runtime/test_dataflow.py b/tests/_runtime/test_dataflow.py
similarity index 100%
rename from marimo/_runtime/test_dataflow.py
rename to tests/_runtime/test_dataflow.py
diff --git a/marimo/_runtime/test_runtime.py b/tests/_runtime/test_runtime.py
similarity index 99%
rename from marimo/_runtime/test_runtime.py
rename to tests/_runtime/test_runtime.py
index 4605e22d74..a184928ef8 100644
--- a/marimo/_runtime/test_runtime.py
+++ b/tests/_runtime/test_runtime.py
@@ -10,7 +10,6 @@ from marimo._messaging.errors import (
MultipleDefinitionError,
)
from marimo._plugins.ui._core.ids import IDProvider
-from marimo._runtime.conftest import ExecReqProvider
from marimo._runtime.dataflow import Edge
from marimo._runtime.requests import (
CreationRequest,
@@ -20,6 +19,7 @@ from marimo._runtime.requests import (
SetUIElementValueRequest,
)
from marimo._runtime.runtime import Kernel
+from tests.conftest import ExecReqProvider
def _check_edges(error: Error, expected_edges: Sequence[Edge]) -> None:
diff --git a/marimo/_runtime/test_state.py b/tests/_runtime/test_state.py
similarity index 98%
rename from marimo/_runtime/test_state.py
rename to tests/_runtime/test_state.py
index 82f6b77409..2d6ca1f9ca 100644
--- a/marimo/_runtime/test_state.py
+++ b/tests/_runtime/test_state.py
@@ -1,6 +1,6 @@
# Copyright 2023 Marimo. All rights reserved.
-from marimo._runtime.conftest import ExecReqProvider
from marimo._runtime.runtime import Kernel
+from tests.conftest import ExecReqProvider
def test_set_and_get_state(k: Kernel, exec_req: ExecReqProvider) -> None:
diff --git a/marimo/_runtime/test_validate_graph.py b/tests/_runtime/test_validate_graph.py
similarity index 100%
rename from marimo/_runtime/test_validate_graph.py
rename to tests/_runtime/test_validate_graph.py
diff --git a/marimo/_runtime/test_virtual_file.py b/tests/_runtime/test_virtual_file.py
similarity index 99%
rename from marimo/_runtime/test_virtual_file.py
rename to tests/_runtime/test_virtual_file.py
index 3d992fdaba..31d0dd7444 100644
--- a/marimo/_runtime/test_virtual_file.py
+++ b/tests/_runtime/test_virtual_file.py
@@ -1,10 +1,10 @@
# Copyright 2023 Marimo. All rights reserved.
from __future__ import annotations
-from marimo._runtime.conftest import ExecReqProvider
from marimo._runtime.context import get_context
from marimo._runtime.requests import DeleteRequest
from marimo._runtime.runtime import Kernel
+from tests.conftest import ExecReqProvider
def test_virtual_file_creation(k: Kernel, exec_req: ExecReqProvider) -> None:
diff --git a/marimo/_utils/test_flatten.py b/tests/_utils/test_flatten.py
similarity index 100%
rename from marimo/_utils/test_flatten.py
rename to tests/_utils/test_flatten.py
diff --git a/marimo/_utils/test_parse_dataclass.py b/tests/_utils/test_parse_dataclass.py
similarity index 100%
rename from marimo/_utils/test_parse_dataclass.py
rename to tests/_utils/test_parse_dataclass.py
diff --git a/marimo/_runtime/conftest.py b/tests/conftest.py
similarity index 100%
rename from marimo/_runtime/conftest.py
rename to tests/conftest.py