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: `check` ignore for ci (#6474)
Dylan Madisetticf39aaac0a67
diff --git a/tests/_lint/test_generated_with_comparison.py b/tests/_lint/test_generated_with_comparison.pynew file mode 100644index 0000000000..fa6e729f1d--- /dev/null+++ b/tests/_lint/test_generated_with_comparison.py@@ -0,0 +1,123 @@+# Copyright 2025 Marimo. All rights reserved.++from marimo._lint.linter import _contents_differ_excluding_generated_with+++def test_contents_differ_excluding_generated_with():+ """Test that __generated_with differences are ignored in content comparison."""++ # Test case 1: Only __generated_with differs+ original = """import marimo++__generated_with = "0.8.0"+app = marimo.App()++def test():+ return++if __name__ == "__main__":+ app.run()+"""++ generated = """import marimo++__generated_with = "0.9.0"+app = marimo.App()++def test():+ return++if __name__ == "__main__":+ app.run()+"""++ # Should return False (no meaningful differences)+ assert not _contents_differ_excluding_generated_with(original, generated)+++def test_contents_differ_with_real_changes():+ """Test that real code differences are detected."""++ original = """import marimo++__generated_with = "0.8.0"+app = marimo.App()++def test():+ x = 1+ return++if __name__ == "__main__":+ app.run()+"""++ generated = """import marimo++__generated_with = "0.9.0"+app = marimo.App()++def test():+ x = 2 # Changed value+ return++if __name__ == "__main__":+ app.run()+"""++ # Should return True (real differences exist)+ assert _contents_differ_excluding_generated_with(original, generated)+++def test_contents_no_generated_with():+ """Test comparison when no __generated_with line exists."""++ original = """import marimo++app = marimo.App()++def test():+ return+"""++ generated = """import marimo++app = marimo.App()++def test():+ return+"""++ # Should return False (identical content)+ assert not _contents_differ_excluding_generated_with(original, generated)+++def test_contents_mixed_generated_with():+ """Test when only one file has __generated_with."""++ original = """import marimo++app = marimo.App()++def test():+ return+"""++ generated = """import marimo++__generated_with = "0.9.0"+app = marimo.App()++def test():+ return+"""++ # Should return True (one has __generated_with, one doesn't)+ assert _contents_differ_excluding_generated_with(original, generated)diff --git a/tests/_lint/test_ignore_scripts.py b/tests/_lint/test_ignore_scripts.pynew file mode 100644index 0000000000..4619694328--- /dev/null+++ b/tests/_lint/test_ignore_scripts.py@@ -0,0 +1,64 @@+# Copyright 2025 Marimo. All rights reserved.++from marimo._lint import run_check+++def test_ignore_scripts_flag(tmp_path):+ """Test that --ignore-scripts suppresses errors for non-marimo files."""++ # Create a temporary non-marimo Python file+ temp_file = tmp_path / "test_script.py"+ temp_file.write_text("""#!/usr/bin/env python3++# This is a regular Python script, not a marimo notebook+import os+import sys++def main():+ print("Hello, world!")+ return 0++if __name__ == "__main__":+ sys.exit(main())+""")++ # Test without ignore_scripts flag - should error+ linter_with_error = run_check((str(temp_file),), ignore_scripts=False)+ assert linter_with_error.errored is True+ assert len(linter_with_error.files) == 1+ assert linter_with_error.files[0].failed is True+ assert "not a valid notebook" in linter_with_error.files[0].message++ # Test with ignore_scripts flag - should not error+ linter_ignore = run_check((str(temp_file),), ignore_scripts=True)+ assert linter_ignore.errored is False+ assert len(linter_ignore.files) == 1+ assert linter_ignore.files[0].skipped is True+ assert "not a marimo notebook" in linter_ignore.files[0].message+++def test_ignore_scripts_still_processes_marimo_files(tmp_path):+ """Test that --ignore-scripts still processes valid marimo files."""++ # Create a temporary marimo file+ temp_file = tmp_path / "test_notebook.py"+ temp_file.write_text("""import marimo++__generated_with = "0.15.5"+app = marimo.App()++def _():+ import marimo as mo+ return (mo,)++if __name__ == "__main__":+ app.run()+""")++ # Test with ignore_scripts flag - should still process marimo files+ linter = run_check((str(temp_file),), ignore_scripts=True)+ assert linter.errored is False+ assert len(linter.files) == 1+ assert linter.files[0].failed is False+ assert linter.files[0].skipped is False