Skip to content
Snippets Groups Projects
Unverified Commit 23b52273 authored by Xavier Robin's avatar Xavier Robin
Browse files

refactor: move imports to beginning of file

parent 53fc5c9b
No related branches found
No related tags found
No related merge requests found
import inspect
import sys
import unittest
from ost import xmlrunner
from ost.conop import GetDefaultLib
def RunTests(): def RunTests():
''' """
This function behaves as a custom TestLoader for python unittests. This function behaves as a custom TestLoader for python unittests.
With no system arguments, the default unittest TestRunner is used. With no system arguments, the default unittest TestRunner is used.
...@@ -31,20 +39,15 @@ def RunTests(): ...@@ -31,20 +39,15 @@ def RunTests():
from ost import testutils from ost import testutils
testutils.RunTests() testutils.RunTests()
''' """
import unittest
import sys
try: try:
if len(sys.argv)>1 and sys.argv[1]=='xml': if len(sys.argv) > 1 and sys.argv[1] == 'xml':
import inspect
import types
import __main__ import __main__
from ost import xmlrunner
for name, obj in inspect.getmembers(__main__): for name, obj in inspect.getmembers(__main__):
if (isinstance(obj, type) and if (isinstance(obj, type) and
issubclass(obj, unittest.TestCase)): issubclass(obj, unittest.TestCase)):
suite = unittest.TestLoader().loadTestsFromTestCase(obj) suite = unittest.TestLoader().loadTestsFromTestCase(obj)
stream = open('PYTEST-%s.xml'%name, 'w') stream = open('PYTEST-%s.xml' % name, 'w')
xmlrunner.XMLTestRunner(stream).run(suite) xmlrunner.XMLTestRunner(stream).run(suite)
stream.close() stream.close()
...@@ -55,13 +58,12 @@ def RunTests(): ...@@ -55,13 +58,12 @@ def RunTests():
def DefaultCompoundLibIsSet(): def DefaultCompoundLibIsSet():
''' """
This function checks if a default compound library is set. This function checks if a default compound library is set.
:return: True, if a compound library was found and set to be accessed with :return: True, if a compound library was found and set to be accessed with
:func:`ost.conop.GetDefaultLib`. False otherwise. :func:`ost.conop.GetDefaultLib`. False otherwise.
''' """
from ost. conop import GetDefaultLib
# check if already there # check if already there
if GetDefaultLib(): if GetDefaultLib():
return True return True
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment