diff --git a/optional_plugins/html/tests/__init__.py b/optional_plugins/html/tests/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/optional_plugins/html/tests/test_html_result.py b/optional_plugins/html/tests/test_html_result.py
new file mode 100644
index 0000000000000000000000000000000000000000..a1989e9d41490c57b71bab916ba1a068ff4274c7
--- /dev/null
+++ b/optional_plugins/html/tests/test_html_result.py
@@ -0,0 +1,78 @@
+import json
+import os
+import shutil
+import tempfile
+import unittest
+from xml.dom import minidom
+
+from avocado.core import exit_codes
+from avocado.utils import genio
+from avocado.utils import process
+
+
+class HtmlResultTest(unittest.TestCase):
+ def setUp(self):
+ self.tmpdir = tempfile.mkdtemp(prefix='avocado_' + __name__)
+
+ def check_output_files(self, debug_log):
+ base_dir = os.path.dirname(debug_log)
+ json_output_path = os.path.join(base_dir, 'results.json')
+ self.assertTrue(os.path.isfile(json_output_path))
+ with open(json_output_path, 'r') as fp:
+ json.load(fp)
+ xunit_output_path = os.path.join(base_dir, 'results.xml')
+ self.assertTrue(os.path.isfile(json_output_path))
+ try:
+ minidom.parse(xunit_output_path)
+ except Exception as details:
+ xunit_output_content = genio.read_file(xunit_output_path)
+ raise AssertionError("Unable to parse xunit output: %s\n\n%s"
+ % (details, xunit_output_content))
+ tap_output = os.path.join(base_dir, "results.tap")
+ self.assertTrue(os.path.isfile(tap_output))
+ tap = genio.read_file(tap_output)
+ self.assertIn("..", tap)
+ self.assertIn("\n# debug.log of ", tap)
+
+ def test_output_incompatible_setup(self):
+ cmd_line = ('avocado run --job-results-dir %s --sysinfo=off '
+ '--html - passtest.py' % self.tmpdir)
+ result = process.run(cmd_line, ignore_status=True)
+ expected_rc = exit_codes.AVOCADO_JOB_FAIL
+ output = result.stdout + result.stderr
+ self.assertEqual(result.exit_status, expected_rc,
+ "Avocado did not return rc %d:\n%s" %
+ (expected_rc, result))
+ error_excerpt = b"HTML to stdout not supported"
+ self.assertIn(error_excerpt, output,
+ "Missing excerpt error message from output:\n%s" % output)
+
+ def test_output_compatible_setup_2(self):
+ prefix = 'avocado_' + __name__
+ tmpfile = tempfile.mktemp(prefix=prefix, dir=self.tmpdir)
+ tmpfile2 = tempfile.mktemp(prefix=prefix, dir=self.tmpdir)
+ tmpdir = tempfile.mkdtemp(prefix=prefix, dir=self.tmpdir)
+ tmpfile3 = os.path.join(tmpdir, "result.html")
+ cmd_line = ('avocado run --job-results-dir %s --sysinfo=off '
+ '--xunit %s --json %s --html %s --tap-include-logs '
+ 'passtest.py' % (self.tmpdir, tmpfile, tmpfile2, tmpfile3))
+ result = process.run(cmd_line, ignore_status=True)
+ output = result.stdout + result.stderr
+ expected_rc = exit_codes.AVOCADO_ALL_OK
+ tmpdir_contents = os.listdir(tmpdir)
+ self.assertEqual(len(tmpdir_contents), 1, "Html plugin generated "
+ "extra files in the result dir: %s"
+ % tmpdir_contents)
+ self.assertEqual(result.exit_status, expected_rc,
+ "Avocado did not return rc %d:\n%s" %
+ (expected_rc, result))
+ self.assertNotEqual(output, "", "Output is empty")
+ # Check if we are producing valid outputs
+ with open(tmpfile2, 'r') as fp:
+ json_results = json.load(fp)
+ debug_log = json_results['debuglog']
+ self.check_output_files(debug_log)
+ minidom.parse(tmpfile)
+
+ def tearDown(self):
+ shutil.rmtree(self.tmpdir)
diff --git a/selftests/functional/test_output.py b/selftests/functional/test_output.py
index 4e39915b193f69f6c4a07326e98afd64b61dd152..4c15a46786cab94e9b3cdcbbfe595f93d3b893bc 100644
--- a/selftests/functional/test_output.py
+++ b/selftests/functional/test_output.py
@@ -6,8 +6,6 @@ import tempfile
import unittest
from xml.dom import minidom
-import pkg_resources
-
from avocado.core import exit_codes
from avocado.core.output import TermSupport
from avocado.utils import genio
@@ -120,14 +118,6 @@ def image_output_uncapable():
return True
-def html_uncapable():
- try:
- pkg_resources.require('avocado-framework-plugin-result-html')
- return False
- except pkg_resources.DistributionNotFound:
- return True
-
-
def perl_tap_parser_uncapable():
return os.system("perl -e 'use TAP::Parser;'") != 0
@@ -319,21 +309,6 @@ class OutputPluginTest(unittest.TestCase):
"Missing error message from output:\n%s" %
result.stderr)
- @unittest.skipIf(html_uncapable(),
- "Uncapable of Avocado Result HTML plugin")
- def test_output_incompatible_setup_2(self):
- cmd_line = ('%s run --job-results-dir %s --sysinfo=off '
- '--html - passtest.py' % (AVOCADO, self.tmpdir))
- result = process.run(cmd_line, ignore_status=True)
- expected_rc = exit_codes.AVOCADO_JOB_FAIL
- output = result.stdout + result.stderr
- self.assertEqual(result.exit_status, expected_rc,
- "Avocado did not return rc %d:\n%s" %
- (expected_rc, result))
- error_excerpt = b"HTML to stdout not supported"
- self.assertIn(error_excerpt, output,
- "Missing excerpt error message from output:\n%s" % output)
-
def test_output_compatible_setup(self):
tmpfile = tempfile.mktemp(dir=self.tmpdir)
cmd_line = ('%s run --job-results-dir %s --sysinfo=off '
@@ -367,36 +342,6 @@ class OutputPluginTest(unittest.TestCase):
self.check_output_files(debug_log)
minidom.parseString(output)
- @unittest.skipIf(html_uncapable(),
- "Uncapable of Avocado Result HTML plugin")
- def test_output_compatible_setup_3(self):
- prefix = 'avocado_' + __name__
- tmpfile = tempfile.mktemp(prefix=prefix, dir=self.tmpdir)
- tmpfile2 = tempfile.mktemp(prefix=prefix, dir=self.tmpdir)
- tmpdir = tempfile.mkdtemp(prefix=prefix, dir=self.tmpdir)
- tmpfile3 = os.path.join(tmpdir, "result.html")
- cmd_line = ('%s run --job-results-dir %s --sysinfo=off '
- '--xunit %s --json %s --html %s --tap-include-logs '
- 'passtest.py' % (AVOCADO, self.tmpdir, tmpfile, tmpfile2,
- tmpfile3))
- result = process.run(cmd_line, ignore_status=True)
- output = result.stdout + result.stderr
- expected_rc = exit_codes.AVOCADO_ALL_OK
- tmpdir_contents = os.listdir(tmpdir)
- self.assertEqual(len(tmpdir_contents), 1, "Html plugin generated "
- "extra files in the result dir: %s"
- % tmpdir_contents)
- self.assertEqual(result.exit_status, expected_rc,
- "Avocado did not return rc %d:\n%s" %
- (expected_rc, result))
- self.assertNotEqual(output, "", "Output is empty")
- # Check if we are producing valid outputs
- with open(tmpfile2, 'r') as fp:
- json_results = json.load(fp)
- debug_log = json_results['debuglog']
- self.check_output_files(debug_log)
- minidom.parse(tmpfile)
-
def test_output_compatible_setup_nooutput(self):
tmpfile = tempfile.mktemp(dir=self.tmpdir)
tmpfile2 = tempfile.mktemp(dir=self.tmpdir)