Skip to content

add pulp, pyomo integration tests#945

Open
Iroy30 wants to merge 3 commits intoNVIDIA:mainfrom
Iroy30:add_pulp_pyomo_ci_testing
Open

add pulp, pyomo integration tests#945
Iroy30 wants to merge 3 commits intoNVIDIA:mainfrom
Iroy30:add_pulp_pyomo_ci_testing

Conversation

@Iroy30
Copy link
Member

@Iroy30 Iroy30 commented Mar 9, 2026

Description

Fixes #295

Issue

Checklist

  • I am familiar with the Contributing Guidelines.
  • Testing
    • New or existing tests cover these changes
    • Added tests
    • Created an issue to follow-up
    • NA
  • Documentation
    • The documentation is up to date with these changes
    • Added new documentation
    • NA

@Iroy30 Iroy30 requested a review from a team as a code owner March 9, 2026 20:02
@Iroy30 Iroy30 requested a review from gforsyth March 9, 2026 20:03
@copy-pr-bot
Copy link

copy-pr-bot bot commented Mar 9, 2026

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@coderabbitai
Copy link

coderabbitai bot commented Mar 9, 2026

📝 Walkthrough

Walkthrough

The 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

Cohort / File(s) Summary
Main test script update
ci/test_wheel_cuopt.sh
Extended nightly build path to execute run_pulp_tests.sh and run_pyomo_tests.sh in addition to existing third-party test scripts.
Third-party test scripts
ci/thirdparty-testing/run_pulp_tests.sh, ci/thirdparty-testing/run_pyomo_tests.sh
New Bash scripts that clone PuLP and Pyomo repositories, install in editable mode with constraints, and run cuOpt-filtered pytest with 5-minute timeout enforcement.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: adding integration tests for PuLP and Pyomo libraries to the CI pipeline.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description check ✅ Passed The PR description is minimal and consists mainly of the contribution template with unchecked checklist items. However, the PR title 'add pulp, pyomo integration tests' clearly indicates the changes involve adding PuLP and Pyomo integration tests, which aligns with the changeset that adds three new CI test scripts for these purposes.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Comment @coderabbitai help to get the list of available commands and usage tips.

@Iroy30 Iroy30 added non-breaking Introduces a non-breaking change improvement Improves an existing functionality labels Mar 9, 2026
@Iroy30
Copy link
Member Author

Iroy30 commented Mar 9, 2026

/ok to test 93d8529

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
ci/thirdparty-testing/run_pulp_tests.sh (1)

9-12: Consider relying on set -u for unbound variable detection.

The explicit guard provides a helpful custom message, but repository convention prefers letting set -u handle 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

📥 Commits

Reviewing files that changed from the base of the PR and between c36ae1d and 93d8529.

📒 Files selected for processing (3)
  • ci/test_wheel_cuopt.sh
  • ci/thirdparty-testing/run_pulp_tests.sh
  • ci/thirdparty-testing/run_pyomo_tests.sh

Comment on lines +28 to +34
timeout 5m python -m pytest \
--verbose \
--capture=no \
-k "cuopt or CUOPT" \
pyomo/solvers/tests/

popd || exit 1
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 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-check

Repository: 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.

@anandhkb anandhkb added this to the 26.04 milestone Mar 9, 2026
@Iroy30
Copy link
Member Author

Iroy30 commented Mar 10, 2026

/ok to test efe07ee

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

improvement Improves an existing functionality non-breaking Introduces a non-breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEA] Modeler Integration Tests

2 participants