5 from ost
import xmlrunner
11 This function behaves as a custom TestLoader for python unittests.
13 With no system arguments, the default unittest TestRunner is used.
15 If the first system argument (sys.argv[1]) is set to 'xml', a XMLTestRunner
16 is used, which produces a JUnit compatible XML output file. Within the current
17 module, each function is identified which is a subclass of unittest.TestCase
18 and for each TestCase, a test suite is executed, producing an individual
19 output file for each TestCase. The output file has the name,
20 'PYTEST-<TestCaseName>.xml'.
22 Example of a Python testcase:
24 .. code-block:: python
28 class TestRenumber(unittest.TestCase):
34 def testSomeFunction(self):
38 if __name__ == "__main__":
39 from ost import testutils
44 if len(sys.argv) > 1
and sys.argv[1] ==
'xml':
46 for name, obj
in inspect.getmembers(__main__):
47 if (isinstance(obj, type)
and
48 issubclass(obj, unittest.TestCase)):
49 suite = unittest.TestLoader().loadTestsFromTestCase(obj)
50 stream = open(
'PYTEST-%s.xml' % name,
'w')
56 except Exception
as e:
62 This function checks if a default compound library is set.
64 :return: True, if a compound library was found and set to be accessed with
65 :func:`ost.conop.GetDefaultLib`. False otherwise.
def DefaultCompoundLibIsSet