# Distributed under the terms of the GNU General Public License v2
# $Id$
-import os, shutil, sys
-from os.path import dirname, abspath, join
+from portage import os
+from portage import shutil
from portage.tests import TestCase
from portage.process import spawn
from portage.const import PORTAGE_BIN_PATH
-bindir = join(dirname(dirname(abspath(__file__))),
+bindir = os.path.join(os.path.dirname(os.path.dirname(
+ os.path.abspath(__file__))),
"..", "..", "..", "bin", "ebuild-helpers")
-basedir = join(dirname(dirname(abspath(__file__))), "bin", "root")
+basedir = os.path.join(os.path.dirname(os.path.dirname(
+ os.path.abspath(__file__))), "bin", "root")
os.environ["D"] = os.path.join(basedir, "image")
os.environ["T"] = os.path.join(basedir, "temp")
os.environ["S"] = os.path.join(basedir, "workdir")
def portage_func(func, args, exit_status=0):
# we don't care about the output of the programs,
# just their exit value and the state of $D
- f = open('/dev/null', 'w')
+ f = open('/dev/null', 'wb')
fd_pipes = {0:0,1:f.fileno(),2:f.fileno()}
spawn(func+" "+args, env=os.environ, fd_pipes=fd_pipes)
f.close()
# Distributed under the terms of the GNU General Public License v2
# $Id$
-import errno, os, sys
+import codecs
+import errno
+import sys
+from portage import os
+from portage import _content_encoding
+from portage import _fs_encoding
+from portage import _unicode_encode
from portage.tests import TestCase
class SpawnTestCase(TestCase):
spawn("echo -n '%s'" % test_string, settings, logfile=logfile,
free=1, fd_pipes={0:sys.stdin.fileno(), 1:null_fd, 2:null_fd})
os.close(null_fd)
- f = open(logfile, 'r')
+ f = codecs.open(_unicode_encode(logfile,
+ encoding=_fs_encoding, errors='strict'),
+ mode='r', encoding=_content_encoding, errors='strict')
log_content = f.read()
f.close()
# When logging passes through a pty, this comparison will fail
# Distributed under the terms of the GNU General Public License v2
# $Id$
+from portage import os
from portage.tests import TestCase
from portage.env.config import PackageKeywordsFile
from tempfile import mkstemp
-import os
class PackageKeywordsFileTestCase(TestCase):
f.close()
def NukeFile(self):
- import os
os.unlink(self.fname)
# Distributed under the terms of the GNU General Public License v2
# $Id$
-import os
-
+from portage import os
from portage.env.config import PackageMaskFile
from portage.tests import TestCase, test_cps
from tempfile import mkstemp
# Distributed under the terms of the GNU General Public License v2
# $Id$
-import os
+from portage import os
from portage.tests import TestCase
from portage.env.config import PackageUseFile
from tempfile import mkstemp
+# Copyright 2006-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+from portage import os
from portage.tests import TestCase
from portage.env.config import PortageModulesFile
from tempfile import mkstemp
from itertools import izip
-import os
class PortageModulesFileTestCase(TestCase):
# Distributed under the terms of the GNU General Public License v2
# $Id$
-import os
+from portage import os
from portage.tests import TestCase
from portage.news import NewsItem
-from portage.const import PROFILE_PATH
from portage.dbapi.virtual import testdbapi
from tempfile import mkstemp
# TODO(antarus) Make newsitem use a loader so we can load using a string instead of a tempfile
# Distributed under the terms of the GNU General Public License v2
# $Id$
-import errno, os, sys
-import fcntl
-import termios
-import portage
-from portage.output import get_term_size, set_term_size
+import sys
+from portage import os
from portage.tests import TestCase
from _emerge.TaskScheduler import TaskScheduler
from _emerge.PipeReader import PipeReader
# Distributed under the terms of the GNU General Public License v2
# $Id$
-import tempfile, os
+import tempfile
+from portage import os
from portage.tests import TestCase, test_cps
from portage.sets.files import ConfigFileSet
# Distributed under the terms of the GNU General Public License v2
# $Id$
-import tempfile, os
+import tempfile
+from portage import os
from portage.tests import TestCase, test_cps
from portage.sets.files import StaticFileSet
-from portage.env.loaders import TestTextLoader
-from portage.env.config import ConfigLoaderKlass
class StaticFileSetTestCase(TestCase):
"""Simple Test Case for StaticFileSet"""
# Distributed under the terms of the GNU General Public License v2
# $Id$
+from portage import os
from portage.tests import TestCase
from portage.util import unique_array
test portage.util.uniqueArray()
"""
- import os
-
tests = [ ( ["a","a","a",os,os,[],[],[]], ['a',os,[]] ),
( [1,1,1,2,3,4,4] , [1,2,3,4]) ]