diff options
| author | Guido van Rossum <guido@python.org> | 2007-05-15 18:46:22 (GMT) |
|---|---|---|
| committer | Guido van Rossum <guido@python.org> | 2007-05-15 18:46:22 (GMT) |
| commit | 1bc535dc7854b6be009a6bf3413a3a470e3fe749 (patch) | |
| tree | 7a43646468849a9ae624bd4314ff26b7b0e30f21 /Lib/test/test_popen2.py | |
| parent | 360e4b8fb19f34360093bc15ef9aad13115a6069 (diff) | |
| download | cpython-1bc535dc7854b6be009a6bf3413a3a470e3fe749.zip cpython-1bc535dc7854b6be009a6bf3413a3a470e3fe749.tar.gz cpython-1bc535dc7854b6be009a6bf3413a3a470e3fe749.tar.bz2 | |
Merged revisions 55328-55341 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/p3yk
........
r55329 | brett.cannon | 2007-05-14 16:36:56 -0700 (Mon, 14 May 2007) | 3 lines
Implement the removal of tuple parameter unpacking (PEP 3113).
Thanks, Tony Lownds for the patch.
........
r55331 | neal.norwitz | 2007-05-14 16:40:30 -0700 (Mon, 14 May 2007) | 1 line
Update to use Python 3.0
........
r55332 | brett.cannon | 2007-05-14 16:47:18 -0700 (Mon, 14 May 2007) | 2 lines
Mention PEP 3113. And thanks to Tony Lownds for the PEP 3113 patch.
........
r55333 | neal.norwitz | 2007-05-14 16:57:06 -0700 (Mon, 14 May 2007) | 1 line
Fix exception printing (no more exceptions module)
........
r55334 | neal.norwitz | 2007-05-14 17:11:10 -0700 (Mon, 14 May 2007) | 1 line
Remove popen* functions from os
........
r55335 | neal.norwitz | 2007-05-14 18:03:38 -0700 (Mon, 14 May 2007) | 1 line
Get rid of most of popen. There are still some uses I need to cleanup.
........
r55336 | neal.norwitz | 2007-05-14 21:11:34 -0700 (Mon, 14 May 2007) | 1 line
Remove a few more remnants of the compiler package
........
r55337 | neal.norwitz | 2007-05-14 22:28:27 -0700 (Mon, 14 May 2007) | 1 line
Get test_[cx]pickle working on 64-bit platforms (avoid overflow int/long)
........
Diffstat (limited to 'Lib/test/test_popen2.py')
| -rw-r--r-- | Lib/test/test_popen2.py | 98 |
1 files changed, 0 insertions, 98 deletions
diff --git a/Lib/test/test_popen2.py b/Lib/test/test_popen2.py deleted file mode 100644 index 023871f..0000000 --- a/Lib/test/test_popen2.py +++ /dev/null @@ -1,98 +0,0 @@ -#! /usr/bin/env python -"""Test script for popen2.py""" - -import warnings -warnings.filterwarnings("ignore", ".*popen2 module is deprecated.*", - DeprecationWarning) -warnings.filterwarnings("ignore", "os\.popen. is deprecated.*", - DeprecationWarning) - -import os -import sys -import unittest -import popen2 - -from test.test_support import TestSkipped, run_unittest, reap_children - -if sys.platform[:4] == 'beos' or sys.platform[:6] == 'atheos': - # Locks get messed up or something. Generally we're supposed - # to avoid mixing "posix" fork & exec with native threads, and - # they may be right about that after all. - raise TestSkipped("popen2() doesn't work on " + sys.platform) - -# if we don't have os.popen, check that -# we have os.fork. if not, skip the test -# (by raising an ImportError) -try: - from os import popen - del popen -except ImportError: - from os import fork - del fork - -class Popen2Test(unittest.TestCase): - cmd = "cat" - if os.name == "nt": - cmd = "more" - teststr = "ab cd\n" - # "more" doesn't act the same way across Windows flavors, - # sometimes adding an extra newline at the start or the - # end. So we strip whitespace off both ends for comparison. - expected = teststr.strip() - - def setUp(self): - popen2._cleanup() - # When the test runs, there shouldn't be any open pipes - self.assertFalse(popen2._active, "Active pipes when test starts" + - repr([c.cmd for c in popen2._active])) - - def tearDown(self): - for inst in popen2._active: - inst.wait() - popen2._cleanup() - self.assertFalse(popen2._active, "_active not empty") - reap_children() - - def validate_output(self, teststr, expected_out, r, w, e=None): - w.write(teststr) - w.close() - got = r.read() - self.assertEquals(expected_out, got.strip(), "wrote %r read %r" % - (teststr, got)) - - if e is not None: - got = e.read() - self.assertFalse(got, "unexpected %r on stderr" % got) - - def test_popen2(self): - r, w = popen2.popen2(self.cmd) - self.validate_output(self.teststr, self.expected, r, w) - - def test_popen3(self): - if os.name == 'posix': - r, w, e = popen2.popen3([self.cmd]) - self.validate_output(self.teststr, self.expected, r, w, e) - - r, w, e = popen2.popen3(self.cmd) - self.validate_output(self.teststr, self.expected, r, w, e) - - def test_os_popen2(self): - # same test as test_popen2(), but using the os.popen*() API - w, r = os.popen2(self.cmd) - self.validate_output(self.teststr, self.expected, r, w) - - def test_os_popen3(self): - # same test as test_popen3(), but using the os.popen*() API - if os.name == 'posix': - w, r, e = os.popen3([self.cmd]) - self.validate_output(self.teststr, self.expected, r, w, e) - - w, r, e = os.popen3(self.cmd) - self.validate_output(self.teststr, self.expected, r, w, e) - - -def test_main(): - run_unittest(Popen2Test) - -if __name__ == "__main__": - test_main() |
