bpo-38493: Add os.CLD_KILLED and CLD_STOPPED for os#16821
bpo-38493: Add os.CLD_KILLED and CLD_STOPPED for os#16821serhiy-storchaka merged 6 commits intopython:masterfrom
Conversation
| @unittest.skipUnless(hasattr(signal, 'SIGCHLD'), 'CLD_XXXX be placed in si_code for a SIGCHLD signal') | ||
| @unittest.skipUnless(hasattr(os, 'waitid_result'), "test needs os.waitid_result") | ||
| def test_cld_xxxx_constants(self): | ||
| # reference: http://man7.org/linux/man-pages/man2/sigaction.2.html |
There was a problem hiding this comment.
These names are not Linux specific, and on other OSes they can have other values.
There was a problem hiding this comment.
These names are not Linux specific, and on other OSes they can have other values.
I 've updated the unit test.
Please let me know if you have better ideas.
There was a problem hiding this comment.
Linux: http://man7.org/linux/man-pages/man2/sigaction.2.html
BSD: https://www.freebsd.org/cgi/man.cgi?query=siginfo&sektion=3&apropos=0&manpath=FreeBSD+7.1-RELEASE
Apple: https://opensource.apple.com/source/xnu/xnu-344/bsd/sys/signal.h
Is it enough to check hasattr(signal, 'SIGCHLD')?
|
@serhiy-storchaka
I think that checking hasattr(os, 'waitid_result') and hasattr(signal, 'SIGCHLD') for unit test What do you think? |
| @unittest.skipUnless(hasattr(signal, 'SIGCHLD'), 'CLD_XXXX be placed in si_code for a SIGCHLD signal') | ||
| @unittest.skipUnless(hasattr(os, 'waitid_result'), "test needs os.waitid_result") | ||
| def test_cld_xxxx_constants(self): | ||
| self.assertTrue(hasattr(os, 'CLD_EXITED')) |
There was a problem hiding this comment.
It is enough to just get an attribute:
os.CLD_EXITEDThese constants are a part of Posix, but I am not sure that they are implemented in all Unixes (as you see, some was not implemented in old Linux). In particularly, I have doubts about AIX. But let try.
https://bugs.python.org/issue38493