Skip to content

test: add staged pytest integration suite#182

Merged
marcellodebernardi merged 6 commits into
mainfrom
codex/staged-integration-pytest
Mar 2, 2026
Merged

test: add staged pytest integration suite#182
marcellodebernardi merged 6 commits into
mainfrom
codex/staged-integration-pytest

Conversation

@marcellodebernardi

Copy link
Copy Markdown
Contributor

This PR replaces ad hoc integration runs with a pytest-native staged integration suite and a single developer entrypoint, and cleans up verbose integration logging output. The aim is to give contributors one simple pre-PR integration workflow that reuses checkpoints across stages while keeping terminal output readable.

Testing

  • poetry run ruff check tests/integration tests/unit/agents/test_feedback.py
  • poetry run black --check tests/integration tests/unit/agents/test_feedback.py
  • poetry run pytest tests/unit/agents/test_feedback.py -q
  • poetry run pytest tests/integration --collect-only -q
  • poetry run ruff check plexe/config.py plexe/execution/dataproc/session.py tests/unit/test_config.py
  • poetry run black --check plexe/config.py plexe/execution/dataproc/session.py tests/unit/test_config.py
  • poetry run pytest tests/unit/test_config.py -q
  • bash -n scripts/tests/run_integration_staged.sh

Copilot AI review requested due to automatic review settings March 2, 2026 12:59

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR replaces ad hoc integration runs with a pytest-native staged integration suite, adds pytest-xdist as a dev dependency, and fixes a duplicate-log issue by setting propagate = False on the plexe logger in setup_logging().

Changes:

  • Adds a three-stage pytest integration suite (test_stage1_seed, test_stage2_search, test_stage3_eval_predict) with shared fixtures/helpers in a new conftest.py, driven by a new shell entrypoint script
  • Adds pytest-xdist ^3.8.0 as a dev dependency and declares the three integration stage markers in pyproject.toml
  • Fixes duplicate log output by setting package_logger.propagate = False in setup_logging(), and guards TestAgentFeedbackIntegration with @pytest.mark.skipif when pyspark is unavailable

Reviewed changes

Copilot reviewed 16 out of 17 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/integration/conftest.py Shared session-scoped fixtures, helper functions, and the integration environment setup for all staged tests
tests/integration/test_stage1_seed.py Stage 1: builds seed checkpoints (phases 1–3)
tests/integration/test_stage2_search.py Stage 2: copies seeds and runs model search (phase 4)
tests/integration/test_stage3_eval_predict.py Stage 3: runs final evaluation, packaging, and predictor inference
tests/integration/integration_config.yaml Integration test config (LLM, Spark, sample sizes)
scripts/tests/run_integration_staged.sh Bash entrypoint that runs the three pytest stages sequentially
plexe/config.py Fixes duplicate log output by disabling propagation on the plexe logger
plexe/execution/dataproc/session.py Updates a comment to better describe Maven JAR caching behavior
tests/unit/test_config.py Adds unit test verifying setup_logging() disables propagation
tests/unit/agents/test_feedback.py Adds @pytest.mark.skipif guard and pyspark-conditional config fixture
tests/unit/agents/__init__.py New __init__.py for the agents unit test package
pyproject.toml Adds pytest-xdist ^3.8.0 dev dependency and integration stage markers
poetry.lock Lockfile update for execnet + pytest-xdist
Makefile Adds test-integration and test-integration-verbose targets
CONTRIBUTING.md Documents the new staged integration workflow for contributors
AGENTS.md Adds make test-integration to the quick reference
tests/CODE_INDEX.md Updated documentation index for new and moved test files
Comments suppressed due to low confidence (1)

tests/unit/agents/test_feedback.py:109

  • The mock_config fixture is defined inside TestAgentFeedbackIntegration, which is already guarded by @pytest.mark.skipif(not PYSPARK_AVAILABLE, ...). This means the fixture body only executes when PYSPARK_AVAILABLE is True. The inner check if importlib.util.find_spec("pyspark") is None: at line 107 can therefore never be True when the fixture runs, making lines 107–108 dead code that will never execute. This dead code should be removed to avoid confusion.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread scripts/tests/run_integration_staged.sh Outdated
Comment thread tests/integration/conftest.py Outdated
@greptile-apps

greptile-apps Bot commented Mar 2, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR introduces a pytest-native staged integration suite that replaces ad hoc integration runs with a structured 3-stage workflow and significantly improves the contributor experience.

Key improvements:

  • Created staged integration framework with hard barriers between phases (seed → search → eval)
  • Implemented checkpoint reuse across stages to avoid redundant computation
  • Added model type filtering on workflow resume to enable framework-specific testing
  • Fixed duplicate logging output by disabling logger propagation when pytest captures logs
  • Moved test_feedback.py from integration to unit tests with proper directory organization
  • Added comprehensive documentation in CONTRIBUTING.md and build targets in Makefile

Architecture:

  • Stage 1 (integration_seed): Builds reusable checkpoints through phase 3 for each dataset kind
  • Stage 2 (integration_search): Copies seeds, resumes with model-specific filtering, runs search phase
  • Stage 3 (integration_eval): Completes evaluation, packaging, and validates predictor inference

Testing approach:
The implementation includes thorough unit tests for the new _apply_allowed_model_types_on_resume() function and comprehensive integration tests validating the full workflow across multiple model types (xgboost, catboost, lightgbm, pytorch). The shell script includes proper error handling with set -euo pipefail, cleanup traps for CatBoost artifacts, and dependency validation for pytest-xdist.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The implementation is well-structured with comprehensive test coverage, proper error handling, and follows established patterns. All changes are additive (new test framework) or defensive (logging fixes, model type filtering). The shell script uses proper error handling (set -euo pipefail), cleanup traps, and dependency validation. Unit tests cover the new workflow filtering logic with edge cases. No security concerns or breaking changes.
  • No files require special attention

Important Files Changed

Filename Overview
scripts/tests/run_integration_staged.sh New bash script orchestrating 3-stage pytest integration suite with proper error handling, cleanup traps, and dependency validation
tests/integration/conftest.py Comprehensive fixture module providing seed workflow builders, checkpoint copying with path rewriting, and predictor loading utilities
tests/integration/test_stage1_seed.py Stage 1 tests build reusable checkpoints through phase 3, properly asserting pause behavior and checkpoint existence
tests/integration/test_stage2_search.py Stage 2 tests copy seeds, resume workflows with model-specific filtering, and verify search completion without evaluation
tests/integration/test_stage3_eval_predict.py Stage 3 tests complete workflow execution, validate packaged artifacts, and run inference checks via dynamically loaded predictors
plexe/workflow.py Added _apply_allowed_model_types_on_resume() to filter checkpoint model types on resume, with proper error handling for empty intersections
plexe/config.py Set package_logger.propagate = False to prevent duplicate log output when pytest live logging is enabled
tests/unit/workflow/test_resume_model_type_filtering.py Comprehensive unit tests for model type filtering on resume, covering filtering, empty checkpoint handling, and error cases

Last reviewed commit: 05c45d7

@marcellodebernardi marcellodebernardi force-pushed the codex/staged-integration-pytest branch from 9894375 to 2df2242 Compare March 2, 2026 13:25
@marcellodebernardi

Copy link
Copy Markdown
Contributor Author

@greptileai please review again with latest changes

@marcellodebernardi marcellodebernardi merged commit 07b4cf4 into main Mar 2, 2026
13 checks passed
@marcellodebernardi marcellodebernardi deleted the codex/staged-integration-pytest branch March 2, 2026 16:38
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.

2 participants