Skip to content

test(kill): fix fail on no other 1* pids than 1#1581

Open
scop wants to merge 1 commit intomainfrom
test/kill-1
Open

test(kill): fix fail on no other 1* pids than 1#1581
scop wants to merge 1 commit intomainfrom
test/kill-1

Conversation

@scop
Copy link
Owner

@scop scop commented Mar 1, 2026

Reproducible e.g. by starting our test centos7 container in interactive mode, and then immediately pytest test/t/test_kill.py in it.

Comment on lines +8 to +9
completion # more than one starting with 1
or completion.endswith(" ") # pid 1 only
Copy link
Owner Author

@scop scop Mar 1, 2026

Choose a reason for hiding this comment

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

This has a code smell to me -- would have expected completion to be ["1"] offhand when the only completion is 1 and thus completion to be truthy. But I've forgotten about the dirty details, maybe this is how it should be done.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think completion contains the added suffix for a unique completion. In this case, completion == " " should be more specific.

Copy link
Owner Author

Choose a reason for hiding this comment

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

That doesn't work though, CompletionResult's __eq__ would make that compare against [" "] and fail, while the endswith test works.

Copy link
Collaborator

@akinomyoga akinomyoga Mar 1, 2026

Choose a reason for hiding this comment

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

Ah, sorry. I meant completion.output == " ". We already use .output In multiple places.

Copy link
Owner Author

Choose a reason for hiding this comment

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

Ah right, that's better, switched in 13ee6e3...8ccf9da.

Reproducible e.g. by starting our test centos7 container in interactive
mode, and then immediately `pytest test/t/test_kill.py` in it.

Co-authored-by: Koichi Murase <myoga.murase@gmail.com>
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