Guido van Rossum | 59e4f37 | 1999-03-11 13:26:23 +0000 | [diff] [blame] | 1 | #! /usr/bin/env python |
| 2 | """Test script for popen2.py |
| 3 | Christian Tismer |
| 4 | """ |
| 5 | |
| 6 | # popen2 contains its own testing routine |
| 7 | # which is especially useful to see if open files |
Fredrik Lundh | 9407e55 | 2000-07-27 07:42:43 +0000 | [diff] [blame] | 8 | # like stdin can be read successfully by a forked |
Guido van Rossum | 59e4f37 | 1999-03-11 13:26:23 +0000 | [diff] [blame] | 9 | # subprocess. |
| 10 | |
| 11 | def main(): |
Fredrik Lundh | 9407e55 | 2000-07-27 07:42:43 +0000 | [diff] [blame] | 12 | try: |
| 13 | from os import popen |
| 14 | except ImportError: |
| 15 | # if we don't have os.popen, check that |
| 16 | # we have os.fork. if not, skip the test |
| 17 | # (by raising an ImportError) |
| 18 | from os import fork |
Guido van Rossum | 59e4f37 | 1999-03-11 13:26:23 +0000 | [diff] [blame] | 19 | import popen2 |
| 20 | popen2._test() |
| 21 | |
| 22 | main() |
| 23 | |