Skip to content

tests: skip pdsh tests when pdsh is not installed#626

Merged
thiell merged 1 commit into
clustershell:masterfrom
thiell:tests-skip-pdsh
Jun 15, 2026
Merged

tests: skip pdsh tests when pdsh is not installed#626
thiell merged 1 commit into
clustershell:masterfrom
thiell:tests-skip-pdsh

Conversation

@thiell

@thiell thiell commented Jun 13, 2026

Copy link
Copy Markdown
Collaborator

Running the test suite on a host without pdsh is currently fatal: in test_033_worker_pdsh_tty, clush's tty code path runs the command in a separate task thread; the failed pdsh spawn raises WorkerError("Cannot run pdsh (error 255)") there, which reaches clush_excepthook and ends in os._exit(1) — silently killing the whole unittest process mid-test. Watching the suite log, this looks like a hang (the log freezes at test_033 ... with no result; the error message is lost in the captured stderr).

  • add a small which() helper to tests/TLib.py
  • skip with @unittest.skipIf(which('pdsh') is None, ...): the three TaskDistantPdshTest classes, CLIClushTest test_032/test_033, and the two TaskRLimitsTest WorkerPdsh tests
  • CI installs pdsh explicitly (tests.yml "Install pdsh to test WorkerPdsh"), so CI coverage is unchanged; this only fixes runs on dev machines

Verified without pdsh installed: all guarded tests now skip and the suite completes normally; with pdsh present the guards are no-ops.

Comment thread tests/TLib.py
# Get machine short hostname
HOSTNAME = socket.gethostname().split('.', 1)[0]

def which(program):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Add a comment like:
# Should be replaced by shutil.which() when we drop everything < Py3.3

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

done thx!

@degremont degremont left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

minor comment, otherwise LGTM

Signed-off-by: Stephane Thiell <sthiell@stanford.edu>
@thiell thiell force-pushed the tests-skip-pdsh branch from f35b585 to 75cde78 Compare June 15, 2026 18:55
@thiell thiell added this pull request to the merge queue Jun 15, 2026
@thiell thiell added this to the 1.10 milestone Jun 15, 2026
Merged via the queue into clustershell:master with commit c0f4e3a Jun 15, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants