Have TestSCons.py add --warn=no-python-version every invocation, not
authorstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Sun, 13 Sep 2009 23:33:03 +0000 (23:33 +0000)
committerstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Sun, 13 Sep 2009 23:33:03 +0000 (23:33 +0000)
just at TestSCons intialization.

git-svn-id: http://scons.tigris.org/svn/scons/trunk@4360 fdb21ef1-2011-0410-befe-b5e4ea1792b1

QMTest/TestSCons.py

index 89fe5a64773ea0512b8d8a5f5cc45f596e56cbb6..b4e910a4c1df034cb6ec4fa38f8b484f5051dcdf 100644 (file)
@@ -245,15 +245,6 @@ class TestSCons(TestCommon):
         # TERM can cause test failures due to control chars in prompts etc.
         os.environ['TERM'] = 'dumb'
 
-        if deprecated_python_version():
-            sconsflags = os.environ.get('SCONSFLAGS')
-            if sconsflags:
-                sconsflags = [sconsflags]
-            else:
-                sconsflags = []
-            sconsflags = sconsflags + ['--warn=no-python-version']
-            os.environ['SCONSFLAGS'] = string.join(sconsflags)
-
         apply(TestCommon.__init__, [self], kw)
 
         import SCons.Node.FS
@@ -341,6 +332,26 @@ class TestSCons(TestCommon):
                build_str + \
                term
 
+    def run(self, *args, **kw):
+        """
+        Add the --warn=no-python-version option to SCONSFLAGS every
+        command so test scripts don't have to filter out Python version
+        deprecation warnings.
+        """
+        save_sconsflags = os.environ.get('SCONSFLAGS')
+        if deprecated_python_version():
+            if save_sconsflags:
+                sconsflags = [save_sconsflags]
+            else:
+                sconsflags = []
+            sconsflags = sconsflags + ['--warn=no-python-version']
+            os.environ['SCONSFLAGS'] = string.join(sconsflags)
+        try:
+            result = apply(TestCommon.run, (self,)+args, kw)
+        finally:
+            sconsflags = save_sconsflags
+        return result
+
     def up_to_date(self, options = None, arguments = None, read_str = "", **kw):
         s = ""
         for arg in string.split(arguments):