Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
Assertion is user-name dependent and can become flaky
get_status_of_my_jobs()filters bygetpass.getuser()via_get_user().The assertion that the result length is
0only passes when the executing user is not"janj"or"maxi".Running the suite on a machine where the current user matches one of those names will make the test fail even though the code works.
Tighten the test by mocking the username (or asserting the exact returned list) so the outcome is deterministic:
(You'll need
import unittest.mocknear the top of the file.)This removes the environment dependency and specifies the expected value directly.
🏁 Script executed:
Length of output: 2478
Remove environment dependency in
test_get_status_of_my_jobsThe test at tests/test_slurm.py:197 asserts that calling
slurm_tmp.get_status_of_my_jobs()returns zero jobs using the real user from the environment. Sinceget_status_of_my_jobs()ultimately calls_get_user()→getpass.getuser(), it will be non-zero when run as a user who actually has jobs queued.Tighten this test by mocking the adapter’s
_get_user()so it always returns a dummy user with no jobs:• File: tests/test_slurm.py
Line: 197
This removes any reliance on the runtime username and makes the expectation explicit.
📝 Committable suggestion
🤖 Prompt for AI Agents