1👍
✅
The output of your nose.run()
does not correspond to your test method. The default behavior for unittest.TestCase
is to throw an exception. If you would like to signal an external code some specific detail, you can always do it through global/class variables, files, etc.
For example, this is how to do it with a class variable (results
)
ft1_runner.py:
import nose
import ft1_test
if __name__ == '__main__':
out = nose.run(module=ft1_test, exit=False)
print 'Y1.test_y1 test results returned:', ft1_test.Y1.results['test_y1']
ft1_test.py:
import unittest
class Y1(unittest.TestCase):
results = {}
def test_y1(self):
Y1.results['test_y1'] = "this is a returned value"
I think it would help if you can describe the problem you are trying to solve: this seems a little awkward and error prone (what if the test is called twice, or test skipped, etc.)
Source:stackexchange.com