summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pym/portage/tests/bin/setup_env.py12
-rw-r--r--pym/portage/tests/ebuild/test_spawn.py12
-rw-r--r--pym/portage/tests/env/config/test_PackageKeywordsFile.py3
-rw-r--r--pym/portage/tests/env/config/test_PackageMaskFile.py3
-rw-r--r--pym/portage/tests/env/config/test_PackageUseFile.py2
-rw-r--r--pym/portage/tests/env/config/test_PortageModulesFile.py5
-rw-r--r--pym/portage/tests/news/test_NewsItem.py3
-rw-r--r--pym/portage/tests/process/test_poll.py7
-rw-r--r--pym/portage/tests/sets/files/testConfigFileSet.py3
-rw-r--r--pym/portage/tests/sets/files/testStaticFileSet.py5
-rw-r--r--pym/portage/tests/util/test_uniqueArray.py3
11 files changed, 32 insertions, 26 deletions
diff --git a/pym/portage/tests/bin/setup_env.py b/pym/portage/tests/bin/setup_env.py
index 727f02e7b..aab210ee9 100644
--- a/pym/portage/tests/bin/setup_env.py
+++ b/pym/portage/tests/bin/setup_env.py
@@ -3,15 +3,17 @@
# 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")
@@ -52,7 +54,7 @@ def xexists_in_D(path):
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()
diff --git a/pym/portage/tests/ebuild/test_spawn.py b/pym/portage/tests/ebuild/test_spawn.py
index 1ba6e5847..908fce606 100644
--- a/pym/portage/tests/ebuild/test_spawn.py
+++ b/pym/portage/tests/ebuild/test_spawn.py
@@ -2,7 +2,13 @@
# 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):
@@ -27,7 +33,9 @@ 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
diff --git a/pym/portage/tests/env/config/test_PackageKeywordsFile.py b/pym/portage/tests/env/config/test_PackageKeywordsFile.py
index 228ce4a82..228cf2ecb 100644
--- a/pym/portage/tests/env/config/test_PackageKeywordsFile.py
+++ b/pym/portage/tests/env/config/test_PackageKeywordsFile.py
@@ -3,10 +3,10 @@
# 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):
@@ -38,5 +38,4 @@ class PackageKeywordsFileTestCase(TestCase):
f.close()
def NukeFile(self):
- import os
os.unlink(self.fname)
diff --git a/pym/portage/tests/env/config/test_PackageMaskFile.py b/pym/portage/tests/env/config/test_PackageMaskFile.py
index dca8002bc..90cdf5387 100644
--- a/pym/portage/tests/env/config/test_PackageMaskFile.py
+++ b/pym/portage/tests/env/config/test_PackageMaskFile.py
@@ -3,8 +3,7 @@
# 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
diff --git a/pym/portage/tests/env/config/test_PackageUseFile.py b/pym/portage/tests/env/config/test_PackageUseFile.py
index aa18364a0..575ede505 100644
--- a/pym/portage/tests/env/config/test_PackageUseFile.py
+++ b/pym/portage/tests/env/config/test_PackageUseFile.py
@@ -3,7 +3,7 @@
# 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
diff --git a/pym/portage/tests/env/config/test_PortageModulesFile.py b/pym/portage/tests/env/config/test_PortageModulesFile.py
index fb164b4a7..40472104b 100644
--- a/pym/portage/tests/env/config/test_PortageModulesFile.py
+++ b/pym/portage/tests/env/config/test_PortageModulesFile.py
@@ -1,9 +1,12 @@
+# 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):
diff --git a/pym/portage/tests/news/test_NewsItem.py b/pym/portage/tests/news/test_NewsItem.py
index f4a073504..721ab2690 100644
--- a/pym/portage/tests/news/test_NewsItem.py
+++ b/pym/portage/tests/news/test_NewsItem.py
@@ -3,10 +3,9 @@
# 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
diff --git a/pym/portage/tests/process/test_poll.py b/pym/portage/tests/process/test_poll.py
index 3f4a597b4..22aa6aa8b 100644
--- a/pym/portage/tests/process/test_poll.py
+++ b/pym/portage/tests/process/test_poll.py
@@ -2,11 +2,8 @@
# 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
diff --git a/pym/portage/tests/sets/files/testConfigFileSet.py b/pym/portage/tests/sets/files/testConfigFileSet.py
index 7ea17fd1b..95ea4f44a 100644
--- a/pym/portage/tests/sets/files/testConfigFileSet.py
+++ b/pym/portage/tests/sets/files/testConfigFileSet.py
@@ -3,8 +3,9 @@
# 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
diff --git a/pym/portage/tests/sets/files/testStaticFileSet.py b/pym/portage/tests/sets/files/testStaticFileSet.py
index fff583da1..138c99e5e 100644
--- a/pym/portage/tests/sets/files/testStaticFileSet.py
+++ b/pym/portage/tests/sets/files/testStaticFileSet.py
@@ -3,12 +3,11 @@
# 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"""
diff --git a/pym/portage/tests/util/test_uniqueArray.py b/pym/portage/tests/util/test_uniqueArray.py
index e1b9caec8..e9485b126 100644
--- a/pym/portage/tests/util/test_uniqueArray.py
+++ b/pym/portage/tests/util/test_uniqueArray.py
@@ -3,6 +3,7 @@
# 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
@@ -13,8 +14,6 @@ class UniqueArrayTestCase(TestCase):
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]) ]