Loading ...
Sorry, an error occurred while loading the content.

[Cheetahtemplate-discuss] [PATCH] get rid of DeprecationWarnings when running tests

Expand Messages
  • Mike Bonnet
    Implemented the popen2.Popen4 interface using the subprocess.Popen backend, to avoid DeprecationWarnings when running the tests on python = 2.6. ...
    Message 1 of 2 , Sep 17, 2009
    • 0 Attachment
      Implemented the popen2.Popen4 interface using the subprocess.Popen backend, to avoid DeprecationWarnings when running the tests on python >= 2.6.

      ---
      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
      Cheetahtemplate-discuss@...
      https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
    • R. Tyler Ballance
      ... Ack d and applied to the next branch at: git://github.com/rtyler/cheetah.git Will be rolled into the v2.3.0 release ... -R. Tyler Ballance Slide, Inc.
      Message 2 of 2 , Sep 17, 2009
      • 0 Attachment
        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
        > Cheetahtemplate-discuss@...
        > https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
        -R. Tyler Ballance
        Slide, Inc.
      Your message has been successfully submitted and would be delivered to recipients shortly.