sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #11969
[Question #203783]: Python unittest and reporting exit status back to Windows shell
New question #203783 on Sikuli:
https://answers.launchpad.net/sikuli/+question/203783
I'm using the Python unittest implementation, and trying to get an exit status to "bubble-up" to the Windows shell. I basically want the basic functionality provided by unittest.main(), but Sikuli uses TextTestRunner and I cannot figure out how to get the
The commands I'm running are the following:
$ java -jar "c:\Program Files\Sikuli X\sikuli-script.jar" PrototypeRuns.sikuli
$ echo %ERRORLEVEL%
The ERRORLEVEL is always 0. I've tried adding a sys.exit() and passing in the number of errors, but this causes Sikuli to report "[error] Can't run this Sikuli script: PrototypeRuns.sikuli"
My code is very small/basic, and I think I'm just missing something because I'm a n00b:
from sikuli import *
import unittest
class UnitTestA(unittest.TestCase):
def setUp(self):
return None
def tearDown(self):
return None
def testAlwaysFails(self):
assert(False)
if __name__ == '__main__':
suite = unittest.TestLoader().loadTestsFromTestCase(UnitTestA)
runner = unittest.TextTestRunner(verbosity=2)
result = runner.run(suite)
# combines the number of errors and failures
status = len(result.errors) + len(result.failures)
sys.exit(status)
Any help is greatly appreciated! Thanks -Chris
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.