未验证 提交 4b6ba388 编写于 作者: A Amador Pahim

Merge branch 'clebergnu-python3_port_2'

Signed-off-by: NAmador Pahim <apahim@redhat.com>
...@@ -27,7 +27,7 @@ class FailTest(Test): ...@@ -27,7 +27,7 @@ class FailTest(Test):
""" """
Avocado should report this as TestError. Avocado should report this as TestError.
""" """
raise NastyException("Nasty-string-like-exception") raise NastyException("Nasty-string-like-exception") # pylint: disable=E0710
if __name__ == "__main__": if __name__ == "__main__":
......
...@@ -222,10 +222,9 @@ class HTMLResult(Result): ...@@ -222,10 +222,9 @@ class HTMLResult(Result):
setsid = getattr(os, 'setsid', None) setsid = getattr(os, 'setsid', None)
if not setsid: if not setsid:
setsid = getattr(os, 'setpgrp', None) setsid = getattr(os, 'setpgrp', None)
inout = file(os.devnull, "r+")
cmd = ['xdg-open', html_path] cmd = ['xdg-open', html_path]
subprocess.Popen(cmd, close_fds=True, stdin=inout, subprocess.Popen(cmd, close_fds=True, stdin=subprocess.DEVNULL,
stdout=inout, stderr=inout, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL,
preexec_fn=setsid) preexec_fn=setsid)
def _render(self, result, output_path): def _render(self, result, output_path):
......
...@@ -14,7 +14,7 @@ mock==1.2.0; python_version <= '2.7' ...@@ -14,7 +14,7 @@ mock==1.2.0; python_version <= '2.7'
aexpect==1.4.0 aexpect==1.4.0
psutil==3.1.1 psutil==3.1.1
# six is a stevedore depedency, but we also use it directly # six is a stevedore depedency, but we also use it directly
six==1.9.0 six==1.10.0
# stevedore for loading "new style" plugins # stevedore for loading "new style" plugins
stevedore==1.20.0 stevedore==1.20.0
lxml>=3.4.4 lxml>=3.4.4
......
...@@ -4,6 +4,6 @@ pyliblzma>=0.5.3 ...@@ -4,6 +4,6 @@ pyliblzma>=0.5.3
# REST client (avocado.core.restclient) # REST client (avocado.core.restclient)
requests>=1.2.3 requests>=1.2.3
# six is a stevedore depedency, but we also use it directly # six is a stevedore depedency, but we also use it directly
six>=1.9.0 six>=1.10.0
# stevedore for loading "new style" plugins # stevedore for loading "new style" plugins
stevedore>=0.14 stevedore>=0.14
...@@ -38,7 +38,7 @@ def handle_exception(*exc_info): ...@@ -38,7 +38,7 @@ def handle_exception(*exc_info):
try: try:
import time import time
prefix += time.strftime("%F_%T") + "-" prefix += time.strftime("%F_%T") + "-"
from avocado.core import data_dir from avocado.core import data_dir # pylint: disable=E0611
_crash_dir = os.path.join(data_dir.get_data_dir(), "crashes") _crash_dir = os.path.join(data_dir.get_data_dir(), "crashes")
os.makedirs(_crash_dir) os.makedirs(_crash_dir)
crash_dir = _crash_dir crash_dir = _crash_dir
...@@ -58,7 +58,7 @@ def handle_exception(*exc_info): ...@@ -58,7 +58,7 @@ def handle_exception(*exc_info):
if __name__ == '__main__': if __name__ == '__main__':
sys.excepthook = handle_exception sys.excepthook = handle_exception
from avocado.core.app import AvocadoApp from avocado.core.app import AvocadoApp # pylint: disable=E0611
# Override tmp in case it's not set in env # Override tmp in case it's not set in env
for attr in ("TMP", "TEMP", "TMPDIR"): for attr in ("TMP", "TEMP", "TMPDIR"):
......
...@@ -31,13 +31,13 @@ class Parser(argparse.ArgumentParser): ...@@ -31,13 +31,13 @@ class Parser(argparse.ArgumentParser):
prog='avocado-run-testplan', prog='avocado-run-testplan',
description='Tracks manual test plans progress and results') description='Tracks manual test plans progress and results')
self.add_argument('-t', '--template', type=file, self.add_argument('-t', '--template', type=argparse.FileType('r'),
help='Template file with the predefined test plan') help='Template file with the predefined test plan')
self.add_argument('-o', '--output', self.add_argument('-o', '--output',
help='Output (test plan results) file location') help='Output (test plan results) file location')
self.add_argument('-i', '--input', type=file, self.add_argument('-i', '--input', type=argparse.FileType('r'),
help=('A previously saved result file to use. This ' help=('A previously saved result file to use. This '
'will show a human readable report for the ' 'will show a human readable report for the '
'given result file')) 'given result file'))
......
...@@ -3,7 +3,6 @@ import os ...@@ -3,7 +3,6 @@ import os
import shutil import shutil
import tempfile import tempfile
import unittest import unittest
from lxml import etree
from xml.dom import minidom from xml.dom import minidom
try: try:
...@@ -11,6 +10,12 @@ try: ...@@ -11,6 +10,12 @@ try:
except: except:
from BytesIO import BytesIO from BytesIO import BytesIO
try:
from lxml import etree
SCHEMA_CAPABLE = True
except ImportError:
SCHEMA_CAPABLE = False
from avocado import Test from avocado import Test
from avocado.core import job from avocado.core import job
from avocado.core.result import Result from avocado.core.result import Result
...@@ -56,6 +61,8 @@ class xUnitSucceedTest(unittest.TestCase): ...@@ -56,6 +61,8 @@ class xUnitSucceedTest(unittest.TestCase):
os.remove(self.tmpfile[1]) os.remove(self.tmpfile[1])
shutil.rmtree(self.tmpdir) shutil.rmtree(self.tmpdir)
@unittest.skipUnless(SCHEMA_CAPABLE,
'Unable to validate schema due to missing lxml.etree library')
def test_add_success(self): def test_add_success(self):
self.test_result.start_test(self.test1) self.test_result.start_test(self.test1)
self.test_result.end_test(self.test1.get_state()) self.test_result.end_test(self.test1.get_state())
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册