Re: [PATCH] get rid of DeprecationWarnings when running tests
"R. Tyler Ballance" <[email protected]> Thu, 17 Sep 2009 16:11:47 -0700
| Newsgroups | gmane.comp.python.cheetah |
|---|---|
| Message-ID | <[email protected]> |
On Thu, 17 Sep 2009, Mike Bonnet wrote: > Implemented the popen2.Popen4 interface using the subprocess.Popen backend, to avoid DeprecationWarnings when running the tests on python >= 2.6. Ack'd and applied to the "next" branch at: git://github.com/rtyler/cheetah.git Will be rolled into the v2.3.0 release > > --- > cheetah/Tests/CheetahWrapper.py | 15 +++++++++++++-- > 1 files changed, 13 insertions(+), 2 deletions(-) > > diff --git a/cheetah/Tests/CheetahWrapper.py b/cheetah/Tests/CheetahWrapper.py > index ca7b0ae..e152e68 100644 > --- a/cheetah/Tests/CheetahWrapper.py > +++ b/cheetah/Tests/CheetahWrapper.py > @@ -12,7 +12,6 @@ Besides unittest usage, recognizes the following command-line options: > Show the output of each subcommand. (Normally suppressed.) > ''' > import os > -import popen2 > import re # Used by listTests. > import shutil > import sys > @@ -22,6 +21,18 @@ import unittest > from optparse import OptionParser > from Cheetah.CheetahWrapper import CheetahWrapper # Used by NoBackup. > > +try: > + from subprocess import Popen, PIPE, STDOUT > + class Popen4(Popen): > + def __init__(self, cmd, bufsize=-1): > + super(Popen4, self).__init__(cmd, bufsize=bufsize, > + shell=True, close_fds=True, > + stdin=PIPE, stdout=PIPE, stderr=STDOUT) > + self.tochild = self.stdin > + self.fromchild = self.stdout > + self.childerr = self.stderr > +except ImportError: > + from popen2 import Popen4 > > DELETE = True # True to clean up after ourselves, False for debugging. > OUTPUT = False # Normally False, True for debugging. > @@ -152,7 +163,7 @@ Found %(result)r""" > return rc, output > > def assertPosixSubprocess(self, cmd): > - process = popen2.Popen4(cmd) > + process = Popen4(cmd) > process.tochild.close() > output = process.fromchild.read() > status = process.wait() > -- > 1.6.2.5 > > ------------------------------------------------------------------------------ > Come build with us! The BlackBerry® Developer Conference in SF, CA > is the only developer event you need to attend this year. Jumpstart your > developing skills, take BlackBerry mobile applications to market and stay > ahead of the curve. Join us from November 9-12, 2009. Register now! > http://p.sf.net/sfu/devconf > _______________________________________________ > Cheetahtemplate-discuss mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss -R. Tyler Ballance Slide, Inc. ------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ Cheetahtemplate-discuss mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
signature.asc
(application/pgp-signature, 197 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) iEYEARECAAYFAkqywjMACgkQFCbH3D9R4W8j2QCgp8k4bqxDb+EMc4iFKzYAzDPU Bq0An2fz2nQJSFs9tajflCF3LUtV0Wnu =ebhl -----END PGP SIGNATURE-----