aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'portage_with_autodep/pym/portage/tests/lint')
-rw-r--r--portage_with_autodep/pym/portage/tests/lint/__init__.pyobin140 -> 138 bytes
-rw-r--r--portage_with_autodep/pym/portage/tests/lint/test_bash_syntax.py26
-rw-r--r--portage_with_autodep/pym/portage/tests/lint/test_bash_syntax.pyobin1944 -> 2508 bytes
-rw-r--r--portage_with_autodep/pym/portage/tests/lint/test_compile_modules.py20
-rw-r--r--portage_with_autodep/pym/portage/tests/lint/test_compile_modules.pyobin1855 -> 1829 bytes
-rw-r--r--portage_with_autodep/pym/portage/tests/lint/test_import_modules.py2
-rw-r--r--portage_with_autodep/pym/portage/tests/lint/test_import_modules.pyobin1725 -> 1717 bytes
7 files changed, 29 insertions, 19 deletions
diff --git a/portage_with_autodep/pym/portage/tests/lint/__init__.pyo b/portage_with_autodep/pym/portage/tests/lint/__init__.pyo
index a1241e5..2a1215a 100644
--- a/portage_with_autodep/pym/portage/tests/lint/__init__.pyo
+++ b/portage_with_autodep/pym/portage/tests/lint/__init__.pyo
Binary files differ
diff --git a/portage_with_autodep/pym/portage/tests/lint/test_bash_syntax.py b/portage_with_autodep/pym/portage/tests/lint/test_bash_syntax.py
index aef8d74..fdbb6fe 100644
--- a/portage_with_autodep/pym/portage/tests/lint/test_bash_syntax.py
+++ b/portage_with_autodep/pym/portage/tests/lint/test_bash_syntax.py
@@ -1,20 +1,26 @@
-# Copyright 2010 Gentoo Foundation
+# Copyright 2010-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
+from itertools import chain
import stat
+import subprocess
+import sys
-from portage.const import BASH_BINARY, PORTAGE_BIN_PATH
+from portage.const import BASH_BINARY, PORTAGE_BASE_PATH, PORTAGE_BIN_PATH
from portage.tests import TestCase
from portage import os
-from portage import subprocess_getstatusoutput
from portage import _encodings
-from portage import _shell_quote
from portage import _unicode_decode, _unicode_encode
class BashSyntaxTestCase(TestCase):
def testBashSyntax(self):
- for parent, dirs, files in os.walk(PORTAGE_BIN_PATH):
+ locations = [PORTAGE_BIN_PATH]
+ misc_dir = os.path.join(PORTAGE_BASE_PATH, "misc")
+ if os.path.isdir(misc_dir):
+ locations.append(misc_dir)
+ for parent, dirs, files in \
+ chain.from_iterable(os.walk(x) for x in locations):
parent = _unicode_decode(parent,
encoding=_encodings['fs'], errors='strict')
for x in files:
@@ -36,7 +42,13 @@ class BashSyntaxTestCase(TestCase):
f.close()
if line[:2] == '#!' and \
'bash' in line:
- cmd = "%s -n %s" % (_shell_quote(BASH_BINARY), _shell_quote(x))
- status, output = subprocess_getstatusoutput(cmd)
+ cmd = [BASH_BINARY, "-n", x]
+ cmd = [_unicode_encode(x,
+ encoding=_encodings['fs'], errors='strict') for x in cmd]
+ proc = subprocess.Popen(cmd, stdout=subprocess.PIPE,
+ stderr=subprocess.STDOUT)
+ output = _unicode_decode(proc.communicate()[0],
+ encoding=_encodings['fs'])
+ status = proc.wait()
self.assertEqual(os.WIFEXITED(status) and \
os.WEXITSTATUS(status) == os.EX_OK, True, msg=output)
diff --git a/portage_with_autodep/pym/portage/tests/lint/test_bash_syntax.pyo b/portage_with_autodep/pym/portage/tests/lint/test_bash_syntax.pyo
index a7ddc80..b066527 100644
--- a/portage_with_autodep/pym/portage/tests/lint/test_bash_syntax.pyo
+++ b/portage_with_autodep/pym/portage/tests/lint/test_bash_syntax.pyo
Binary files differ
diff --git a/portage_with_autodep/pym/portage/tests/lint/test_compile_modules.py b/portage_with_autodep/pym/portage/tests/lint/test_compile_modules.py
index f90a666..1d44e68 100644
--- a/portage_with_autodep/pym/portage/tests/lint/test_compile_modules.py
+++ b/portage_with_autodep/pym/portage/tests/lint/test_compile_modules.py
@@ -1,4 +1,4 @@
-# Copyright 2009-2010 Gentoo Foundation
+# Copyright 2009-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
import itertools
@@ -10,8 +10,6 @@ from portage import os
from portage import _encodings
from portage import _unicode_decode, _unicode_encode
-import py_compile
-
class CompileModulesTestCase(TestCase):
def testCompileModules(self):
@@ -34,13 +32,13 @@ class CompileModulesTestCase(TestCase):
do_compile = True
else:
# Check for python shebang
- f = open(_unicode_encode(x,
- encoding=_encodings['fs'], errors='strict'), 'rb')
- line = _unicode_decode(f.readline(),
- encoding=_encodings['content'], errors='replace')
- f.close()
- if line[:2] == '#!' and \
- 'python' in line:
+ with open(_unicode_encode(x,
+ encoding=_encodings['fs'], errors='strict'), 'rb') as f:
+ line = _unicode_decode(f.readline(),
+ encoding=_encodings['content'], errors='replace')
+ if line[:2] == '#!' and 'python' in line:
do_compile = True
if do_compile:
- py_compile.compile(x, cfile='/dev/null', doraise=True)
+ with open(_unicode_encode(x,
+ encoding=_encodings['fs'], errors='strict'), 'rb') as f:
+ compile(f.read(), x, 'exec')
diff --git a/portage_with_autodep/pym/portage/tests/lint/test_compile_modules.pyo b/portage_with_autodep/pym/portage/tests/lint/test_compile_modules.pyo
index 7b1460d..8e32e1f 100644
--- a/portage_with_autodep/pym/portage/tests/lint/test_compile_modules.pyo
+++ b/portage_with_autodep/pym/portage/tests/lint/test_compile_modules.pyo
Binary files differ
diff --git a/portage_with_autodep/pym/portage/tests/lint/test_import_modules.py b/portage_with_autodep/pym/portage/tests/lint/test_import_modules.py
index 8d257c5..34261f4 100644
--- a/portage_with_autodep/pym/portage/tests/lint/test_import_modules.py
+++ b/portage_with_autodep/pym/portage/tests/lint/test_import_modules.py
@@ -1,4 +1,4 @@
-# Copyright 2011 Gentoo Foundation
+# Copyright 2011-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
from portage.const import PORTAGE_PYM_PATH
diff --git a/portage_with_autodep/pym/portage/tests/lint/test_import_modules.pyo b/portage_with_autodep/pym/portage/tests/lint/test_import_modules.pyo
index b3a1d61..b566748 100644
--- a/portage_with_autodep/pym/portage/tests/lint/test_import_modules.pyo
+++ b/portage_with_autodep/pym/portage/tests/lint/test_import_modules.pyo
Binary files differ