summaryrefslogtreecommitdiff
path: root/tests/checkprops.py
blob: 25a26dc0d9ff9580f04cdd336fbdc7cd079ebdf4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33

import traceback
import unittest

import virtinst


class CheckPropsTest(unittest.TestCase):
    maxDiff = None

    def testCheckProps(self):
        # pylint: disable=protected-access
        # Access to protected member, needed to unittest stuff

        # If a certain environment variable is set, XMLBuilder tracks
        # every property registered and every one of those that is
        # actually altered. The test suite sets that env variable.
        #
        # test000ClearProps resets the 'set' list, and this test
        # ensures that every property we know about has been touched
        # by one of the above tests.
        fail = [p for p in virtinst.xmlbuilder._allprops
                if p not in virtinst.xmlbuilder._seenprops]
        try:
            self.assertEqual([], fail)
        except AssertionError:
            msg = "".join(traceback.format_exc()) + "\n\n"
            msg += ("This means that there are XML properties that are\n"
                    "untested in the test suite. This could be caused\n"
                    "by a previous test suite failure, or if you added\n"
                    "a new property and didn't extend the test suite.\n"
                    "Look into extending clitest.py and/or xmlparse.py.")
            self.fail(msg)