Skip to content

fix(dev): fix devcontainer LAMMPS pytest wrapper paths#5697

Queued
wanghan-iapcm wants to merge 1 commit into
deepmodeling:masterfrom
wanghan-iapcm:fix-devcontainer-pytest-lmp-path
Queued

fix(dev): fix devcontainer LAMMPS pytest wrapper paths#5697
wanghan-iapcm wants to merge 1 commit into
deepmodeling:masterfrom
wanghan-iapcm:fix-devcontainer-pytest-lmp-path

Conversation

@wanghan-iapcm

@wanghan-iapcm wanghan-iapcm commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

Problem

The devcontainer LAMMPS pytest wrappers compute SCRIPT_PATH two directories above the wrapper script (SCRIPT_PATH=$(dirname $(realpath -s $0))/../..), while .devcontainer/lmp/gdb_lmp and all the devcontainer build scripts use the .devcontainer directory itself (SCRIPT_PATH=$(dirname $(realpath -s $0))). All wrappers then derive ${SCRIPT_PATH}/../libtorch, ${SCRIPT_PATH}/../dp/lib and ${SCRIPT_PATH}/../.venv. The build scripts install libtorch, dp, and .venv at the repository root (download_libtorch.sh unzips into ${SCRIPT_PATH}/.., build_cxx.sh installs to ${SCRIPT_PATH}/../dp/, build_py.sh runs uv sync from ${SCRIPT_PATH}/..). So the pytest wrappers' extra /../.. resolves those paths two directory levels too high — pointing LAMMPS_PLUGIN_PATH/LD_LIBRARY_PATH outside the checkout.

Fix

Drop the /../.. from .devcontainer/pytest_lmp and .devcontainer/gdb_pytest_lmp so all four wrappers share the same base and resolve to the repository root, consistent with the build scripts.

Scope / impact

These wrappers are interactive developer convenience scripts inside the devcontainer; CI does not invoke them (LAMMPS tests in CI set their own plugin and library paths). The bug therefore only affected a developer manually running .devcontainer/pytest_lmp to debug LAMMPS tests, where the deepmd LAMMPS plugin would fail to load. There is nothing to unit-test here; the fix is verified by inspection — all four wrappers now use an identical SCRIPT_PATH base and identical ${SCRIPT_PATH}/../… derivations.

Fix #5691

The pytest LAMMPS wrappers computed SCRIPT_PATH as the parent of the repo
(dirname .../$0)/../..), while lmp/gdb_lmp and the devcontainer build
scripts use the .devcontainer directory itself. Since all wrappers derive
${SCRIPT_PATH}/../{libtorch,dp/lib,.venv} and the build scripts install
libtorch/dp/.venv at the repo root, the pytest wrappers resolved those two
directory levels too high, pointing LAMMPS_PLUGIN_PATH/LD_LIBRARY_PATH
outside the checkout.

Drop the extra /../.. so all four wrappers share the same base and resolve
to the repo root.

Fix deepmodeling#5691
@dosubot dosubot Bot added the bug label Jul 1, 2026
@wanghan-iapcm wanghan-iapcm requested a review from njzjz July 1, 2026 05:19
@coderabbitai

coderabbitai Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Both devcontainer LAMMPS pytest wrapper scripts (pytest_lmp and gdb_pytest_lmp) are updated to compute SCRIPT_PATH as the script's own directory instead of two directories above it, changing derived paths such as CMAKE_PREFIX_PATH, LAMMPS_PLUGIN_PATH, and LD_LIBRARY_PATH.

Changes

Devcontainer script path fix

Layer / File(s) Summary
SCRIPT_PATH resolution fix
.devcontainer/pytest_lmp, .devcontainer/gdb_pytest_lmp
SCRIPT_PATH now resolves to the script's own directory via dirname(realpath -s $0) instead of two levels above it, aligning derived paths (CMAKE_PREFIX_PATH, LAMMPS_PLUGIN_PATH, LD_LIBRARY_PATH) with the non-pytest LAMMPS wrappers.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Related issues: #5691

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly states the devcontainer LAMMPS pytest wrapper path fix and matches the PR scope.
Linked Issues check ✅ Passed The change aligns the pytest wrappers with the regular wrappers by correcting SCRIPT_PATH in both files as requested in #5691.
Out of Scope Changes check ✅ Passed The diff is narrowly focused on the two wrapper path calculations and adds no unrelated changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@wanghan-iapcm wanghan-iapcm enabled auto-merge July 1, 2026 06:09
@wanghan-iapcm wanghan-iapcm requested review from njzjz and removed request for njzjz July 1, 2026 06:11
@codecov

codecov Bot commented Jul 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.78%. Comparing base (0e5c170) to head (c5da4b5).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5697      +/-   ##
==========================================
- Coverage   81.97%   81.78%   -0.20%     
==========================================
  Files         959      959              
  Lines      105748   105747       -1     
  Branches     4102     4102              
==========================================
- Hits        86684    86481     -203     
- Misses      17573    17770     +197     
- Partials     1491     1496       +5     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@wanghan-iapcm wanghan-iapcm added this pull request to the merge queue Jul 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Code scan] Fix devcontainer LAMMPS pytest wrapper paths

2 participants