Skip to content

[BUGFIX] Stabilize the default test suite and bugfixes - #46

Merged
PeterCalifano merged 7 commits into
developfrom
bugfix/upgrade-test-suite
Sep 7, 2026
Merged

[BUGFIX] Stabilize the default test suite and bugfixes#46
PeterCalifano merged 7 commits into
developfrom
bugfix/upgrade-test-suite

Conversation

@PeterCalifano

@PeterCalifano PeterCalifano commented Sep 6, 2026

Copy link
Copy Markdown
Owner

Summary

This PR brings the seven commits on bugfix/upgrade-test-suite into develop. It fixes SaveModel when a caller passes torch.device, defines the default pytest selection policy, and removes scripts and placeholders that pytest was collecting as tests.

Main changes

Runtime Fix

SaveModel(..., target_device=...) now accepts either a device string or torch.device and normalizes the value through torch.device before deriving the filename-safe device suffix. The regression test saves a state dictionary with target_device=torch.device("cpu") and covers the ModelTrainingManager call path that previously failed while formatting the device name.

Pytest Selection and CUDA Gating

tests/conftest.py adds --run-slow, --run-gpu, and --run-visual; tests carrying those markers are skipped unless the corresponding option is present. The shared CUDA helper now executes and synchronizes a small CUDA operation instead of treating device discovery as proof that the runtime works, while RequireCudaUsable() lets dependent tests skip cleanly when kernels cannot execute. The training-manager integration test is marked slow, GPU-dependent, and integration-level. Dataset visualization, external-dataset loading, augmentation timing, and image-operator tests are marked according to their runtime requirements, and the EfficientNet ONNX check uses the existing export marker.

Test Rework and Cleanup

The manually launched TCP server script is replaced with terminating pytest coverage for a DataProcessor tensor round trip and an ephemeral-port server startup and shutdown. Timing tests patch the performance counter instead of calling sleep(), then verify wrapped return values, call counts, function metadata, positional arguments, and keyword arguments. The CIFAR-10 MLflow/Optuna workflow moves from tests/hparams_optim/test_mlflow_with_optuna.py to examples/example_mlflow_optuna_cifar10_demo.py because it downloads data, runs up to 100 trials, and may start external tracking services. Three files with no executable assertions are removed: test_torch_model_over_tcp.py, test_ModelExplainer.py, and test_TorchModel.py. The tests directory is now an importable support package for the shared CUDA helpers.

Testing and Validation

Local validation passed with 655 tests passed and 74 skipped through ./run_tests.sh -- -q in the Python 3.11 autoforge environment, and with 657 passed and 72 skipped through python -m pytest -q in the Python 3.12 autoforgeV2 environment. The two ONNX pooling export tests that previously failed in autoforge also passed. The local Python 3.11 environment was updated from onnxscript 0.2.0 to onnxscript 0.7.1, which installed onnx-ir 1.0.0 and provides the torch_2_11 exporter adapter required by PyTorch 2.11; this PR does not change an environment or dependency file.

Remote CI Status

Manual workflow run 34027009331 passed package build and installation. The pytest job collected all 729 tests and reported 651 passed, 74 skipped, and 4 failed because DATASETS is not defined on the runner; all four failures are in unchanged tests/datasets/test_DatasetClasses.py. The lint job reported 23 existing F821 errors, none in paths changed by this PR. The workflow does not run automatically for this PR because it still filters pull requests to main and the retired dev_main branch instead of develop.

Compatibility and Review Notes

String-valued target_device calls keep their existing behavior. Slow, GPU, and visual tests now require explicit pytest flags, so default validation does not cover GPU, visual, or external-dataset execution. The moved CIFAR-10 example remains a long-running, networked demonstration but is no longer part of pytest collection. Reviewers should confirm that each deleted placeholder is empty or replaced by the behavior-focused coverage described above, and should read tests/conftest.py with tests/helpers.py because those files jointly define the opt-in marker policy and CUDA runtime check.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 6, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-06T10:18:38.804152Z b307d84 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@PeterCalifano PeterCalifano self-assigned this Sep 6, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b307d8491e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread examples/example_mlflow_optuna_cifar10_demo.py
@PeterCalifano PeterCalifano added the major-enhancement New feature or request label Sep 7, 2026
@PeterCalifano PeterCalifano changed the title [BUGFIX] Stabilize the default test suite [BUGFIX] Stabilize the default test suite and bugfixes Sep 7, 2026
@PeterCalifano
PeterCalifano merged commit fae82b4 into develop Sep 7, 2026
1 of 3 checks passed
@PeterCalifano
PeterCalifano deleted the bugfix/upgrade-test-suite branch September 8, 2026 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

major-enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant