Skip to content

Refactor cel.test() to use pytest internally#694

Merged
chrisgregan merged 3 commits intomainfrom
python-tests
May 7, 2026
Merged

Refactor cel.test() to use pytest internally#694
chrisgregan merged 3 commits intomainfrom
python-tests

Conversation

@chrisgregan
Copy link
Copy Markdown
Contributor

This pull request refactors and modernizes the Celbridge Python integration test suite by migrating it to pytest, introducing a custom test runner and reporter, and restructuring tests and fixtures for clarity and maintainability. It also updates the build process to delegate Python wheel building to a unified script, and makes minor dependency and code improvements.

Integration Test Suite Modernization

  • Migrated the integration test suite from a custom runner to pytest, introducing a custom CelbridgeReporter that provides clear, color-coded test output and integrates with the Celbridge logging system. The new reporter supports class name filtering, disables pytest's default terminal output, and ensures the Windows console state remains intact. (integration_tests/__init__.py)
  • Reorganized test files: added new test modules for app, document, and explorer functionality, each using pytest fixtures and helpers for setup and teardown. (test_app.py, test_document.py, test_explorer.py) [1] [2] [3]
  • Added conftest.py with session-scoped fixtures to provide access to Celbridge proxy modules in tests, replacing previous module-level globals. (integration_tests/conftest.py)
  • Added helpers.py with utility functions for common test operations, such as deleting resources, closing documents, and writing files with specific line endings. (integration_tests/helpers.py)
  • Updated the test entrypoint in cel_proxy.py to use the new integration_tests.run_suite instead of the previous test_suite.main. (cel_proxy.py)

Build and Dependency Updates

  • Changed the .csproj build process to delegate Python wheel building to build.py (using system Python), simplifying the MSBuild logic and removing reliance on the uv tool and temp folders. (Celbridge.Python.csproj)
  • Added pytest as a required dependency in pyproject.toml to support the new test suite. (pyproject.toml)
  • Minor cleanup in build.py to remove unused capture_output argument from subprocess.run. (build.py)

Introduce a pytest-based integration test suite and hook it into the Python proxy build/run flow. Adds a new packages/celbridge/src/celbridge/integration_tests package (CelbridgeReporter, conftest, helpers and many test modules for app/document/explorer/file/file_edit/file_line_endings/package/query/spreadsheet/webview), and removes the old test_suite.py. celbridge.cel_proxy now delegates cel.test(...) to integration_tests.run_suite. Build changes: pyproject.toml adds pytest dependency; build.py no longer captures subprocess output; the .csproj includes recursive Python source globs and delegates wheel building to build.py for the net9.0 target. Also updates the checked-in wheel asset (Assets/Python/celbridge-0.1.0-py3-none-any.whl).
@chrisgregan chrisgregan merged commit f6ceb31 into main May 7, 2026
6 checks passed
@chrisgregan chrisgregan deleted the python-tests branch May 7, 2026 12:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant