This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author py.user
Recipients py.user
Date 2013-08-27.06:48:50
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1377586130.68.0.700857287739.issue18848@psf.upfronthosting.co.za>
In-reply-to
Content
http://docs.python.org/3/library/unittest.html#unittest.TestResult.startTestRun
http://docs.python.org/3/library/unittest.html#unittest.TestResult.stopTestRun



result.py:

#!/usr/bin/env python3

import unittest

class Test(unittest.TestCase):
    def test_1(self):
        print('test_1')

    def test_2(self):
        print('test_2')
        self.fail('msg')
    
class Result(unittest.TestResult):
    def startTestRun(self, test):
        print('starttestrun', test)

    def stopTestRun(self, test):
        print('stoptestrun', test)

    def startTest(self, test):
        print('starttest', test)

    def stopTest(self, test):
        print('stoptest', test)

result = Result()
suite = unittest.defaultTestLoader.loadTestsFromTestCase(Test)
suite.run(result)

print(result)



output:

[guest@localhost result]$ ./result.py 
starttest test_1 (__main__.Test)
test_1
stoptest test_1 (__main__.Test)
starttest test_2 (__main__.Test)
test_2
stoptest test_2 (__main__.Test)
<__main__.Result run=0 errors=0 failures=1>
[guest@localhost result]$



I tried also print messages to a file - same thing
History
Date User Action Args
2013-08-27 06:48:50py.usersetrecipients: + py.user
2013-08-27 06:48:50py.usersetmessageid: <1377586130.68.0.700857287739.issue18848@psf.upfronthosting.co.za>
2013-08-27 06:48:50py.userlinkissue18848 messages
2013-08-27 06:48:50py.usercreate