(self)
| 1258 | @unittest.skipUnless(hasattr(os, 'popen'), "test needs os.popen()") |
| 1259 | @support.requires_subprocess() |
| 1260 | def test_getgroups(self): |
| 1261 | with os.popen('id -G 2>/dev/null') as idg: |
| 1262 | groups = idg.read().strip() |
| 1263 | ret = idg.close() |
| 1264 | |
| 1265 | try: |
| 1266 | idg_groups = set(int(g) for g in groups.split()) |
| 1267 | except ValueError: |
| 1268 | idg_groups = set() |
| 1269 | if ret is not None or not idg_groups: |
| 1270 | raise unittest.SkipTest("need working 'id -G'") |
| 1271 | |
| 1272 | # Issues 16698: OS X ABIs prior to 10.6 have limits on getgroups() |
| 1273 | if sys.platform == 'darwin': |
| 1274 | import sysconfig |
| 1275 | dt = sysconfig.get_config_var('MACOSX_DEPLOYMENT_TARGET') or '10.3' |
| 1276 | if tuple(int(n) for n in dt.split('.')[0:2]) < (10, 6): |
| 1277 | raise unittest.SkipTest("getgroups(2) is broken prior to 10.6") |
| 1278 | |
| 1279 | # 'id -G' and 'os.getgroups()' should return the same |
| 1280 | # groups, ignoring order, duplicates, and the effective gid. |
| 1281 | # #10822/#26944 - It is implementation defined whether |
| 1282 | # posix.getgroups() includes the effective gid. |
| 1283 | symdiff = idg_groups.symmetric_difference(posix.getgroups()) |
| 1284 | self.assertTrue(not symdiff or symdiff == {posix.getegid()}) |
| 1285 | |
| 1286 | @unittest.skipUnless(hasattr(signal, 'SIGCHLD'), 'CLD_XXXX be placed in si_code for a SIGCHLD signal') |
| 1287 | @unittest.skipUnless(hasattr(os, 'waitid_result'), "test needs os.waitid_result") |
nothing calls this directly
no test coverage detected