[PR #1951] fix(tinytorch): integration test collection failure silently treated as no-tests #32215

Open
opened 2026-07-12 08:52:15 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/harvard-edge/cs249r_book/pull/1951
Author: @Shashank-Tripathi-07
Created: 7/7/2026
Status: 🔄 Open

Base: devHead: fix/workflow-integration-test-collection-failure


📝 Commits (1)

  • 77ba36f fix(tinytorch): integration test collection failure silently treated as no-tests

📊 Changes

1 file changed (+13 additions, -0 deletions)

View changed files

📝 tinytorch/tito/commands/module/workflow.py (+13 -0)

📄 Description

Summary

  • _run_integration_tests() captures result.returncode from the pytest subprocess but no caller (complete_module, _complete_module_quiet, run_module_tests) ever reads it -- only 'passed'/'failed' are checked.
  • If pytest fails during collection (e.g. an import-time error in the exported package -- distinct from the notebook-syntax check, which only compile()s notebook cells, not the exported package), it exits nonzero with no PASSED/FAILED lines to parse. _parse_pytest_output returns an empty list, so the result comes back as passed=0, failed=0.
  • Every caller's if integration_result['failed'] > 0 check is then False, so tito module complete prints "No integration tests for this module" and marks the module complete despite the exported package being unimportable/broken.

Fix

Treat "zero parsed tests + nonzero pytest exit code" as a collection failure rather than "no tests exist", surfacing it through the same tests-list/error-field shape _parse_test_output already uses for its own unit-test fallback case. The legitimate "no test file for this module" short-circuit (returns before pytest even runs) and the "pytest ran fine but collected zero tests" case (returncode == 0) are unaffected.

Test plan

  • Fed _parse_pytest_output a real pytest collection-error transcript (ImportError during test collection): confirmed it returns zero parsed tests, matching the bug's premise.
  • Confirmed the new guard turns that into failed=1 instead of the old passed=0/failed=0, which now correctly trips the existing if integration_result['failed'] > 0 branch in every caller.
  • python -m py_compile passes on the edited file.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/harvard-edge/cs249r_book/pull/1951 **Author:** [@Shashank-Tripathi-07](https://github.com/Shashank-Tripathi-07) **Created:** 7/7/2026 **Status:** 🔄 Open **Base:** `dev` ← **Head:** `fix/workflow-integration-test-collection-failure` --- ### 📝 Commits (1) - [`77ba36f`](https://github.com/harvard-edge/cs249r_book/commit/77ba36ff399f2b19670babeddf5078fb08bffd85) fix(tinytorch): integration test collection failure silently treated as no-tests ### 📊 Changes **1 file changed** (+13 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `tinytorch/tito/commands/module/workflow.py` (+13 -0) </details> ### 📄 Description ## Summary - `_run_integration_tests()` captures `result.returncode` from the pytest subprocess but no caller (`complete_module`, `_complete_module_quiet`, `run_module_tests`) ever reads it -- only `'passed'`/`'failed'` are checked. - If pytest fails during **collection** (e.g. an import-time error in the exported package -- distinct from the notebook-syntax check, which only `compile()`s notebook cells, not the exported package), it exits nonzero with no `PASSED`/`FAILED` lines to parse. `_parse_pytest_output` returns an empty list, so the result comes back as `passed=0, failed=0`. - Every caller's `if integration_result['failed'] > 0` check is then `False`, so `tito module complete` prints `"No integration tests for this module"` and marks the module complete despite the exported package being unimportable/broken. ## Fix Treat "zero parsed tests + nonzero pytest exit code" as a collection failure rather than "no tests exist", surfacing it through the same tests-list/error-field shape `_parse_test_output` already uses for its own unit-test fallback case. The legitimate "no test file for this module" short-circuit (returns before pytest even runs) and the "pytest ran fine but collected zero tests" case (`returncode == 0`) are unaffected. ## Test plan - [x] Fed `_parse_pytest_output` a real pytest collection-error transcript (`ImportError` during test collection): confirmed it returns zero parsed tests, matching the bug's premise. - [x] Confirmed the new guard turns that into `failed=1` instead of the old `passed=0/failed=0`, which now correctly trips the existing `if integration_result['failed'] > 0` branch in every caller. - [x] `python -m py_compile` passes on the edited file. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-07-12 08:52:15 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/cs249r_book#32215