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