Merged from trunk 6221:6229
authorFabian Groffen <grobian@gentoo.org>
Sat, 17 Mar 2007 14:36:40 +0000 (14:36 -0000)
committerFabian Groffen <grobian@gentoo.org>
Sat, 17 Mar 2007 14:36:40 +0000 (14:36 -0000)
Fix a typo.

Fix broken exception handling.

Fix a broken test.

ignore *.py[co] (SpankMan)

Use mkstemp to create a random tempfile.

fix for older python who have oddly named __exc_info() (WarnerBro)

bump ________foo from the TestCase class since _exc_info() doesn't do
anything anyway (WarnerBro)

send stdout to /dev/null since we rely on the output of stdout here to
determine the proper suffix #171212 (SpankMan)

svn path=/main/branches/prefix/; revision=6237

bin/ecompress
pym/portage/env/config.py
pym/portage/tests/__init__.py
pym/portage/tests/env/config/test_PackageMaskFile.py

index 49db5f48ee0736e01d56b86348a31df80aad1a46..0b1f0a8e5866b35029b671920efc80f8089ef83e 100755 (executable)
@@ -32,7 +32,7 @@ case $1 in
                # to compress as some programs will refuse to do compression
                # if it cannot actually compress the file
                echo {0..1000} > compressme
-               ${PORTAGE_COMPRESS} ${PORTAGE_COMPRESS_FLAGS} compressme
+               ${PORTAGE_COMPRESS} ${PORTAGE_COMPRESS_FLAGS} compressme > /dev/null
                suffix=$(ls compressme*)
                suffix=${suffix#compressme}
                cd /
index e3898c53967a0c185aa3ea9513d684c226adf64b..675e0105793539e33fbead8712cdcce64a27dae9 100644 (file)
@@ -113,7 +113,7 @@ class PackageUseFile(PackageUse):
                                        else:
                                                self.data[key] = items
 
-class PackageMask(UserDIct):
+class PackageMask(UserDict):
        """
        A base class for Package.mask functionality
        """
index 7d13af1e6cc7a4f55ab9afb30c5e4f00a9d377ef..b7640ab2cb187083ce4dd5dbb0453dde97b42a8d 100644 (file)
@@ -3,7 +3,7 @@
 # Distributed under the terms of the GNU General Public License v2
 # $Id$
 
-import os, unittest, time
+import os, sys, time, unittest
 import portage.tests
 
 def main():
@@ -99,7 +99,7 @@ class TestCase(unittest.TestCase):
                        except KeyboardInterrupt:
                                raise
                        except:
-                               result.addError(self, self._exc_info())
+                               result.addError(self, sys.exc_info())
                                return
                        ok = False
                        try:
@@ -109,17 +109,17 @@ class TestCase(unittest.TestCase):
                                if self.todo:
                                        result.addTodo(self,"%s: TODO" % testMethod)
                                else:
-                                       result.addFailure(self, self._exc_info())
-                       except KeyboardInterrupt:
+                                       result.addFailure(self, sys.exc_info())
+                       except (KeyboardInterrupt, SystemExit):
                                raise
                        except:
-                               result.addError(self, self._exc_info())
+                               result.addError(self, sys.exc_info())
                        try:
                                self.tearDown()
                        except KeyboardInterrupt:
                                raise
                        except:
-                               result.addError(self, self._exc_info())
+                               result.addError(self, sys.exc_info())
                                ok = False
                        if ok: result.addSuccess(self)
                finally:
index f17eaf02163463c85a2fda573d77ece24b4bbea0..83c9095fd37ec228b7fedadfc95f34b76a46acf3 100644 (file)
@@ -3,12 +3,13 @@
 # Distributed under the terms of the GNU General Public License v2
 # $Id: test_PackageMaskFile.py 6182 2007-03-06 07:35:22Z antarus $
 
+import os
+
 from portage.env.config import PackageMaskFile
 from portage.tests import TestCase
 
 class PackageMaskFileTestCase(TestCase):
 
-       fname = 'package.mask'
        atoms = ['sys-apps/portage','dev-util/diffball','not@va1id@t0m']
        
        def testPackageMaskLoad(self):
@@ -21,10 +22,11 @@ class PackageMaskFileTestCase(TestCase):
                        self.NukeFile()
        
        def BuildFile(self):
-               f = open(self.fname, 'wb')
-               f.write("\n".join(atoms))
+               from tempfile import mkstemp
+               fd, self.fname = mkstemp()
+               f = os.fdopen(fd, 'w')
+               f.write("\n".join(self.atoms))
                f.close()
        
        def NukeFile(self):
-               import os
                os.unlink(self.fname)