Conversation
📝 WalkthroughWalkthroughThe PR extends the cuOpt wheel test suite by adding third-party integration testing for PuLP and Pyomo. The main test script is updated to invoke two new test scripts that build these libraries from source and execute cuOpt-specific tests with pytest filtering and timeout controls. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
/ok to test 93d8529 |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
ci/thirdparty-testing/run_pulp_tests.sh (1)
9-12: Consider relying onset -ufor unbound variable detection.The explicit guard provides a helpful custom message, but repository convention prefers letting
set -uhandle unbound variables with default error messages. You could simplify by removing this check and using"${PIP_CONSTRAINT}"directly in the pip install command.Based on learnings: "In this repository, prefer using 'set -u' in Bash scripts to detect unbound variables and rely on the default unbound-variable error messages rather than implementing explicit guards with custom error messages."
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@ci/thirdparty-testing/run_pulp_tests.sh` around lines 9 - 12, The script contains an explicit guard that checks PIP_CONSTRAINT and exits with a custom message; repository convention prefers using set -u to detect unbound variables. Remove the if [ -z "${PIP_CONSTRAINT:-}" ] ... fi block and rely on the existing (or add) set -u at the top of run_pulp_tests.sh, then reference "${PIP_CONSTRAINT}" directly where used (e.g., the pip install or constraint flag) so an unbound variable will produce the standard set -u error instead of the custom guard.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@ci/thirdparty-testing/run_pyomo_tests.sh`:
- Around line 28-34: Capture the pytest exit status after running the existing
timeout + python -m pytest command in run_pyomo_tests.sh (the block that filters
with -k "cuopt or CUOPT"), then add handling for exit code 5 (no tests
collected) similar to the PuLP script: if pytest returns 5 treat it as a
non-failure (exit 0) or otherwise propagate the original exit code; ensure you
reference the pytest invocation and the shell variable holding its exit status
so the script exits consistently.
---
Nitpick comments:
In `@ci/thirdparty-testing/run_pulp_tests.sh`:
- Around line 9-12: The script contains an explicit guard that checks
PIP_CONSTRAINT and exits with a custom message; repository convention prefers
using set -u to detect unbound variables. Remove the if [ -z
"${PIP_CONSTRAINT:-}" ] ... fi block and rely on the existing (or add) set -u at
the top of run_pulp_tests.sh, then reference "${PIP_CONSTRAINT}" directly where
used (e.g., the pip install or constraint flag) so an unbound variable will
produce the standard set -u error instead of the custom guard.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: a244d300-66f5-4c14-828f-a96c9c3b0e99
📒 Files selected for processing (3)
ci/test_wheel_cuopt.shci/thirdparty-testing/run_pulp_tests.shci/thirdparty-testing/run_pyomo_tests.sh
| timeout 5m python -m pytest \ | ||
| --verbose \ | ||
| --capture=no \ | ||
| -k "cuopt or CUOPT" \ | ||
| pyomo/solvers/tests/ | ||
|
|
||
| popd || exit 1 |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Check if Pyomo has cuopt-related tests
git clone --depth 1 https://github.com/Pyomo/pyomo.git /tmp/pyomo-check
rg -l -i "cuopt" /tmp/pyomo-check/pyomo/solvers/tests/ || echo "No cuopt tests found in Pyomo upstream"
rm -rf /tmp/pyomo-checkRepository: NVIDIA/cuopt
Length of output: 332
Consider adding exit code 5 handling for consistency with the PuLP script.
Pyomo does include cuopt-related tests (notably test_cuopt_direct.py), so the -k "cuopt or CUOPT" filter should find matching tests. However, for robustness and consistency with the PuLP script pattern, consider capturing the pytest exit code and handling the no-tests-collected scenario:
🛠️ Suggested enhancement for consistency
echo "running Pyomo tests (cuopt_direct / cuOpt-related)"
# Run only tests that reference cuopt (cuopt_direct solver)
+pytest_rc=0
timeout 5m python -m pytest \
--verbose \
--capture=no \
-k "cuopt or CUOPT" \
- pyomo/solvers/tests/
+ pyomo/solvers/tests/ || pytest_rc=$?
+
+if [ "$pytest_rc" -eq 5 ]; then
+ echo "No pytest -k cuopt tests found in Pyomo"
+ pytest_rc=0
+fi
popd || exit 1
+exit "$pytest_rc"🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@ci/thirdparty-testing/run_pyomo_tests.sh` around lines 28 - 34, Capture the
pytest exit status after running the existing timeout + python -m pytest command
in run_pyomo_tests.sh (the block that filters with -k "cuopt or CUOPT"), then
add handling for exit code 5 (no tests collected) similar to the PuLP script: if
pytest returns 5 treat it as a non-failure (exit 0) or otherwise propagate the
original exit code; ensure you reference the pytest invocation and the shell
variable holding its exit status so the script exits consistently.
|
/ok to test efe07ee |
Description
Fixes #295
Issue
Checklist