未验证 提交 48492a1f 编写于 作者: A Amador Pahim

Merge branch 'clebergnu-python3_enable_functional_v3'

Signed-off-by: NAmador Pahim <apahim@redhat.com>
...@@ -2,6 +2,7 @@ import os ...@@ -2,6 +2,7 @@ import os
import tempfile import tempfile
import shutil import shutil
import unittest import unittest
import sys
from avocado.core import exit_codes from avocado.core import exit_codes
from avocado.utils import process from avocado.utils import process
...@@ -54,6 +55,8 @@ class MultiplexTests(unittest.TestCase): ...@@ -54,6 +55,8 @@ class MultiplexTests(unittest.TestCase):
result = self.run_and_check(cmd_line, expected_rc) result = self.run_and_check(cmd_line, expected_rc)
self.assertIn('No such file or directory', result.stderr_text) self.assertIn('No such file or directory', result.stderr_text)
@unittest.skipIf(sys.version_info[0] == 3,
"Test currently broken on Python 3")
def test_mplex_debug(self): def test_mplex_debug(self):
cmd_line = ('%s variants -c -d -m ' cmd_line = ('%s variants -c -d -m '
'/:optional_plugins/varianter_yaml_to_mux/tests/.data/mux-selftest.yaml ' '/:optional_plugins/varianter_yaml_to_mux/tests/.data/mux-selftest.yaml '
...@@ -139,6 +142,8 @@ class MultiplexTests(unittest.TestCase): ...@@ -139,6 +142,8 @@ class MultiplexTests(unittest.TestCase):
"passtest.py" % (AVOCADO, self.tmpdir)) "passtest.py" % (AVOCADO, self.tmpdir))
self.run_and_check(cmd_line, exit_codes.AVOCADO_ALL_OK, (1, 0)) self.run_and_check(cmd_line, exit_codes.AVOCADO_ALL_OK, (1, 0))
@unittest.skipIf(sys.version_info[0] == 3,
"Test currently broken on Python 3")
def test_run_mplex_params(self): def test_run_mplex_params(self):
for variant_msg in (('/run/short', 'A'), for variant_msg in (('/run/short', 'A'),
('/run/medium', 'ASDFASDF'), ('/run/medium', 'ASDFASDF'),
......
...@@ -24,19 +24,14 @@ parallel_selftests() { ...@@ -24,19 +24,14 @@ parallel_selftests() {
local ERR=0 local ERR=0
local FIND_UNITTESTS=$(readlink -f ./contrib/scripts/avocado-find-unittests) local FIND_UNITTESTS=$(readlink -f ./contrib/scripts/avocado-find-unittests)
local NO_WORKERS=$(($(cat /proc/cpuinfo | grep -c processor) * 2)) local NO_WORKERS=$(($(cat /proc/cpuinfo | grep -c processor) * 2))
local PY3=$(python --version 2>&1 | grep -q "$Python 3\.")$?
# The directories that may contain files with tests, from the Avocado core # The directories that may contain files with tests, from the Avocado core
# and from all optional plugins # and from all optional plugins
declare -A DIR_GLOB_MAP declare -A DIR_GLOB_MAP
if [ $PY3 -eq 1 ]; then
DIR_GLOB_MAP[selftests]="selftests/unit/test_*.py selftests/functional/test_*.py selftests/doc/test_*.py" DIR_GLOB_MAP[selftests]="selftests/unit/test_*.py selftests/functional/test_*.py selftests/doc/test_*.py"
for PLUGIN in $(find optional_plugins -mindepth 1 -maxdepth 1 -type d); do for PLUGIN in $(find optional_plugins -mindepth 1 -maxdepth 1 -type d); do
DIR_GLOB_MAP[$PLUGIN]="tests/test_*.py" DIR_GLOB_MAP[$PLUGIN]="tests/test_*.py"
done; done;
else
DIR_GLOB_MAP[selftests]="selftests/unit/test_*.py selftests/doc/test_*.py"
fi
declare -A TESTS declare -A TESTS
for TEST_DIR in "${!DIR_GLOB_MAP[@]}"; do for TEST_DIR in "${!DIR_GLOB_MAP[@]}"; do
......
...@@ -606,6 +606,8 @@ class RunnerHumanOutputTest(unittest.TestCase): ...@@ -606,6 +606,8 @@ class RunnerHumanOutputTest(unittest.TestCase):
b'INTERRUPT 0 | CANCEL 1', b'INTERRUPT 0 | CANCEL 1',
result.stdout) result.stdout)
@unittest.skipIf(sys.version_info[0] == 3,
"Test currently broken on Python 3")
@unittest.skipIf(not GNU_ECHO_BINARY, @unittest.skipIf(not GNU_ECHO_BINARY,
'GNU style echo binary not available') 'GNU style echo binary not available')
def test_ugly_echo_cmd(self): def test_ugly_echo_cmd(self):
......
...@@ -6,6 +6,7 @@ import stat ...@@ -6,6 +6,7 @@ import stat
import tempfile import tempfile
import shutil import shutil
import signal import signal
import sys
import unittest import unittest
from avocado.core import exit_codes from avocado.core import exit_codes
...@@ -268,6 +269,8 @@ class LoaderTestFunctional(unittest.TestCase): ...@@ -268,6 +269,8 @@ class LoaderTestFunctional(unittest.TestCase):
% (AVOCADO, self.tmpdir, mytest)) % (AVOCADO, self.tmpdir, mytest))
self._run_with_timeout(cmd_line, 5) self._run_with_timeout(cmd_line, 5)
@unittest.skipIf(sys.version_info[0] == 3,
"Test currently broken on Python 3")
@unittest.skipUnless(os.path.exists("/bin/true"), "/bin/true not " @unittest.skipUnless(os.path.exists("/bin/true"), "/bin/true not "
"available") "available")
@unittest.skipUnless(os.path.exists("/bin/echo"), "/bin/echo not " @unittest.skipUnless(os.path.exists("/bin/echo"), "/bin/echo not "
...@@ -326,6 +329,8 @@ class LoaderTestFunctional(unittest.TestCase): ...@@ -326,6 +329,8 @@ class LoaderTestFunctional(unittest.TestCase):
self.assertEqual(test, 11, "Number of tests is not 12 (%s):\n%s" self.assertEqual(test, 11, "Number of tests is not 12 (%s):\n%s"
% (test, result)) % (test, result))
@unittest.skipIf(sys.version_info[0] == 3,
"Test currently broken on Python 3")
def test_python_unittest(self): def test_python_unittest(self):
test_path = os.path.join(basedir, "selftests", ".data", "unittests.py") test_path = os.path.join(basedir, "selftests", ".data", "unittests.py")
cmd = ("%s run --sysinfo=off --job-results-dir %s --json - -- %s" cmd = ("%s run --sysinfo=off --job-results-dir %s --json - -- %s"
......
import json import json
import tempfile
import os import os
import re import re
import shutil import shutil
import sys
import tempfile
import unittest import unittest
from xml.dom import minidom from xml.dom import minidom
...@@ -162,6 +163,8 @@ class OutputTest(unittest.TestCase): ...@@ -162,6 +163,8 @@ class OutputTest(unittest.TestCase):
"Libc double free can be seen in avocado " "Libc double free can be seen in avocado "
"doublefree output:\n%s" % output) "doublefree output:\n%s" % output)
@unittest.skipIf(sys.version_info[0] == 3,
"Test currently broken on Python 3")
def test_print_to_std(self): def test_print_to_std(self):
def _check_output(path, exps, name): def _check_output(path, exps, name):
i = 0 i = 0
...@@ -246,6 +249,8 @@ class OutputTest(unittest.TestCase): ...@@ -246,6 +249,8 @@ class OutputTest(unittest.TestCase):
with open(output_file_path, 'r') as output: with open(output_file_path, 'r') as output:
self.assertEqual(output.read(), '') self.assertEqual(output.read(), '')
@unittest.skipIf(sys.version_info[0] == 3,
"Test currently broken on Python 3")
def test_check_on_off(self): def test_check_on_off(self):
""" """
Checks that output will always be kept, but it will only make into Checks that output will always be kept, but it will only make into
......
import json import json
import os import os
import tempfile
import shutil import shutil
import sys
import tempfile
import unittest import unittest
from avocado.core import exit_codes from avocado.core import exit_codes
...@@ -138,6 +139,8 @@ class RunnerSimpleTest(unittest.TestCase): ...@@ -138,6 +139,8 @@ class RunnerSimpleTest(unittest.TestCase):
(expected_rc, result)) (expected_rc, result))
self.assertIn(tampered_msg, result.stdout) self.assertIn(tampered_msg, result.stdout)
@unittest.skipIf(sys.version_info[0] == 3,
"Test currently broken on Python 3")
def test_output_diff(self): def test_output_diff(self):
self._check_output_record_all() self._check_output_record_all()
tampered_msg_stdout = b"I PITY THE FOOL THAT STANDS ON STDOUT!" tampered_msg_stdout = b"I PITY THE FOOL THAT STANDS ON STDOUT!"
......
...@@ -30,15 +30,9 @@ def test_suite(): ...@@ -30,15 +30,9 @@ def test_suite():
loader = unittest.TestLoader() loader = unittest.TestLoader()
selftests_dir = os.path.dirname(os.path.abspath(__file__)) selftests_dir = os.path.dirname(os.path.abspath(__file__))
basedir = os.path.dirname(selftests_dir) basedir = os.path.dirname(selftests_dir)
if sys.version_info[0] == 3: for section in ('unit', 'functional', 'doc'):
sections = ('unit', 'doc')
else:
sections = ('unit', 'functional', 'doc')
for section in sections:
suite.addTests(loader.discover(start_dir=os.path.join(selftests_dir, section), suite.addTests(loader.discover(start_dir=os.path.join(selftests_dir, section),
top_level_dir=basedir)) top_level_dir=basedir))
if sys.version_info[0] == 3:
return suite
plugins = (('avocado-framework-plugin-varianter-yaml-to-mux', plugins = (('avocado-framework-plugin-varianter-yaml-to-mux',
'varianter_yaml_to_mux'), 'varianter_yaml_to_mux'),
('avocado-framework-plugin-runner-remote', ('avocado-framework-plugin-runner-remote',
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册