(self)
| 759 | @unittest.skipUnless(fcntl and hasattr(fcntl, 'F_GETPIPE_SZ'), |
| 760 | 'fcntl.F_GETPIPE_SZ required for test.') |
| 761 | def test_pipesize_default(self): |
| 762 | proc = subprocess.Popen( |
| 763 | [sys.executable, "-c", |
| 764 | 'import sys; sys.stdin.read(); sys.stdout.write("out"); ' |
| 765 | 'sys.stderr.write("error!")'], |
| 766 | stdin=subprocess.PIPE, stdout=subprocess.PIPE, |
| 767 | stderr=subprocess.PIPE, pipesize=-1) |
| 768 | |
| 769 | with proc: |
| 770 | try: |
| 771 | fp_r, fp_w = os.pipe() |
| 772 | try: |
| 773 | default_read_pipesize = fcntl.fcntl(fp_r, fcntl.F_GETPIPE_SZ) |
| 774 | default_write_pipesize = fcntl.fcntl(fp_w, fcntl.F_GETPIPE_SZ) |
| 775 | finally: |
| 776 | os.close(fp_r) |
| 777 | os.close(fp_w) |
| 778 | |
| 779 | self.assertEqual( |
| 780 | fcntl.fcntl(proc.stdin.fileno(), fcntl.F_GETPIPE_SZ), |
| 781 | default_read_pipesize) |
| 782 | self.assertEqual( |
| 783 | fcntl.fcntl(proc.stdout.fileno(), fcntl.F_GETPIPE_SZ), |
| 784 | default_write_pipesize) |
| 785 | self.assertEqual( |
| 786 | fcntl.fcntl(proc.stderr.fileno(), fcntl.F_GETPIPE_SZ), |
| 787 | default_write_pipesize) |
| 788 | # On other platforms we cannot test the pipe size (yet). But above |
| 789 | # code using pipesize=-1 should not crash. |
| 790 | finally: |
| 791 | proc.kill() |
| 792 | |
| 793 | def test_env(self): |
| 794 | newenv = os.environ.copy() |
nothing calls this directly
no test coverage detected