]> granicus.if.org Git - python/commitdiff
-- changed test to work on platforms which have os.popen
authorFredrik Lundh <fredrik@pythonware.com>
Thu, 27 Jul 2000 07:42:43 +0000 (07:42 +0000)
committerFredrik Lundh <fredrik@pythonware.com>
Thu, 27 Jul 2000 07:42:43 +0000 (07:42 +0000)
   but no os.fork

Lib/test/test_popen2.py

index be79f3c6abdd68a0dcc2886700b04b8774af460b..f6359ce2ebf132c579d3b6ff531915c668952971 100644 (file)
@@ -5,11 +5,17 @@
 
 # popen2 contains its own testing routine
 # which is especially useful to see if open files
-# like stdin can be read successfully by a forked 
+# like stdin can be read successfully by a forked
 # subprocess.
 
 def main():
-    from os import fork # skips test through ImportError
+    try:
+        from os import popen
+    except ImportError:
+        # if we don't have os.popen, check that
+        # we have os.fork.  if not, skip the test
+        # (by raising an ImportError)
+        from os import fork
     import popen2
     popen2._test()