Anna Schumaker
16399f375e
This command reads an xunit file generated by passing "-R xunit" to xfstests `./check`. Multiple xunit files can be added to a single xfstests run, and will be shown side-by-side in columns when printed out. Implements: #3 (`xfstestsdb xunit read`) Signed-off-by: Anna Schumaker <anna@nowheycreamery.com>
32 lines
1.1 KiB
Python
32 lines
1.1 KiB
Python
# Copyright 2023 (c) Anna Schumaker.
|
|
"""Tests the `xfstestsdb xunit` command."""
|
|
import argparse
|
|
import io
|
|
import unittest
|
|
import unittest.mock
|
|
import xfstestsdb
|
|
|
|
|
|
class TestXunit(unittest.TestCase):
|
|
"""Tests the `xfstestsdb xunit` command."""
|
|
|
|
def setUp(self):
|
|
"""Set up common variables."""
|
|
self.xfstestsdb = xfstestsdb.Command()
|
|
self.xunit = self.xfstestsdb.commands["xunit"]
|
|
|
|
def test_init(self):
|
|
"""Check that the xunit command was set up properly."""
|
|
self.assertIsInstance(self.xunit, xfstestsdb.commands.Command)
|
|
self.assertIsInstance(self.xunit, xfstestsdb.xunit.Command)
|
|
self.assertIsInstance(self.xunit.subparser, argparse.Action)
|
|
self.assertEqual(self.xfstestsdb.subparser.choices["xunit"],
|
|
self.xunit.parser)
|
|
|
|
@unittest.mock.patch("sys.stdout", new_callable=io.StringIO)
|
|
def test_xunit_empty(self, mock_stdout: io.StringIO):
|
|
"""Test calling `xfstestdb xunit` with an empty argument list."""
|
|
self.xfstestsdb.run(["xunit"])
|
|
self.assertRegex(mock_stdout.getvalue(),
|
|
r"^usage: .*? xunit \[\-h\] \{.*?} ...$")
|