# 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 /
# 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():
except KeyboardInterrupt:
raise
except:
- result.addError(self, self._exc_info())
+ result.addError(self, sys.exc_info())
return
ok = False
try:
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:
# 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):
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)