Test: Check for missing coordinates in LAMMPS DumpReader#5206
Test: Check for missing coordinates in LAMMPS DumpReader#5206IAyaanHere wants to merge 3 commits intoMDAnalysis:developfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #5206 +/- ##
========================================
Coverage 92.72% 92.72%
========================================
Files 180 180
Lines 22475 22475
Branches 3190 3190
========================================
Hits 20841 20841
Misses 1177 1177
Partials 457 457 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
This seems OK - can you please run Black formatting to get the linting test to pass? |
Thanks! @BradyAJohnston I've downgraded Black to the required version (v24) and applied the formatting fixes. Everything should be clean now. |
| ) | ||
|
|
||
| # reader should raise ValueError because coordinates are missing | ||
| with pytest.raises(ValueError, match="No coordinate information"): |
There was a problem hiding this comment.
This only tests the "No coordinate information", while according to #5127 and https://github.com/MDAnalysis/mdanalysis/pull/5053/changes#r2427645640 the original issue was not having a test catching the wrong f-string. Could you please update the match to check that?
There was a problem hiding this comment.
Thanks @RMeli , You were absolutely right.
I realized that while I was writing the test, the actual source code in LAMMPS.py was still raising the generic error message, which is why the strict regex check would have failed.
I have pushed a new commit that covers everything:
Source Code: Updated MDAnalysis/coordinates/LAMMPS.py to correctly include the filename in the ValueError (this ensures the f-string logic is actually active).
New Test: Updated test_missing_coords_error to use the strict regex match=r"No coordinate information found in .*bad_lammps.dump", verifying the filename is present.
Legacy Test: Updated the existing test_no_coordinate_info to match this new error message format so that the test suite remains green.
Verified locally, and all 157 tests passed.
54683be to
ac51c37
Compare
|
@RMeli I updated the test to use regex so it catches the specific error message now. Ran it locally and it passes. |
Fixes #5127
Changes made in this Pull Request:
test_missing_coords_errorintest_lammps.py.LAMMPS.DumpReadercorrectly raises aValueErrorwhen the input file lacks coordinate columns (x, y, z).tmpdirto generate a temporary dummy file for the test execution.LLM / AI generated code disclosure
LLMs or other AI-powered tools (beyond simple IDE use cases) were used in this contribution: no
PR Checklist
package/CHANGELOGfile updated?package/AUTHORS? (If it is not, add it!)Developers Certificate of Origin
I certify that I can submit this code contribution as described in the Developer Certificate of Origin, under the MDAnalysis LICENSE.
📚 Documentation preview 📚: https://mdanalysis--5206.org.readthedocs.build/en/5206/