Python unittest and reporting exit status back to Windows shell
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-
$ 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.
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(
def setUp(self):
return None
def tearDown(self):
return None
def testAlwaysFails
assert(False)
if __name__ == '__main__':
suite = unittest.
runner = unittest.
result = runner.run(suite)
# combines the number of errors and failures
status = len(result.errors) + len(result.
sys.exit(status)
Any help is greatly appreciated! Thanks -Chris
Question information
- Language:
- English Edit question
- Status:
- Answered
- For:
- SikuliX Edit question
- Assignee:
- No assignee Edit question
- Last query:
- Last reply:
Can you help with this problem?
Provide an answer of your own, or ask Chris Cera for more information if necessary.