(self)
| 191 | support.is_wasi, "WASI does not support dup." |
| 192 | ) |
| 193 | def test_closerange(self): |
| 194 | first = os.open(os_helper.TESTFN, os.O_CREAT|os.O_RDWR) |
| 195 | # We must allocate two consecutive file descriptors, otherwise |
| 196 | # it will mess up other file descriptors (perhaps even the three |
| 197 | # standard ones). |
| 198 | second = os.dup(first) |
| 199 | try: |
| 200 | retries = 0 |
| 201 | while second != first + 1: |
| 202 | os.close(first) |
| 203 | retries += 1 |
| 204 | if retries > 10: |
| 205 | # XXX test skipped |
| 206 | self.skipTest("couldn't allocate two consecutive fds") |
| 207 | first, second = second, os.dup(second) |
| 208 | finally: |
| 209 | os.close(second) |
| 210 | # close a fd that is open, and one that isn't |
| 211 | os.closerange(first, first + 2) |
| 212 | self.assertRaises(OSError, os.write, first, b"a") |
| 213 | |
| 214 | @support.cpython_only |
| 215 | def test_rename(self): |
nothing calls this directly
no test coverage detected