Package portage :: Package tests :: Package env :: Package config :: Module test_PackageMaskFile
[hide private]

Source Code for Module portage.tests.env.config.test_PackageMaskFile

 1  # test_PackageMaskFile.py -- Portage Unit Testing Functionality 
 2  # Copyright 2007 Gentoo Foundation 
 3  # Distributed under the terms of the GNU General Public License v2 
 4   
 5  from portage import os 
 6  from portage.env.config import PackageMaskFile 
 7  from portage.tests import TestCase, test_cps 
 8  from tempfile import mkstemp 
 9   
10 -class PackageMaskFileTestCase(TestCase):
11
12 - def testPackageMaskFile(self):
13 self.BuildFile() 14 try: 15 f = PackageMaskFile(self.fname) 16 f.load() 17 for atom in f: 18 self.assertTrue(atom in test_cps) 19 finally: 20 self.NukeFile()
21
22 - def BuildFile(self):
23 fd, self.fname = mkstemp() 24 f = os.fdopen(fd, 'w') 25 f.write("\n".join(test_cps)) 26 f.close()
27
28 - def NukeFile(self):
29 os.unlink(self.fname)
30