python unit test frame work

Ganesh Pal ganesh1pal at gmail.com
Sat Dec 12 08:01:58 EST 2015


On Thu, Dec 10, 2015 at 9:20 PM, Peter Otten <__peter__ at web.de> wrote:
> Ganesh Pal wrote:
>
> I recommend that you reread the unittest documentation.
>> setUpClass() should be a class method, and if it succeeds you can release
> the ressources it required in the corresponding tearDownClass() method. As
> written the flags and the setUp()/tearDown() seem unnecessary.
>
Thanks to peter , Cameron and Ben Finney , for replying to my various
question post . I needed a hint on the below
1. If there is a setUpClass exception or failure , I don't want the
unittest to run ( I don't have teardown ) how do I handle this ?
 The traceback on the console looks very bad it repeats for all
the test cases , that means if I have 100 testcases if setup fails .
I will get the failure for all the test cases
#c_t.py
EEEE
======================================================================
ERROR: test01: test_01_inode_test
----------------------------------------------------------------------
Traceback (most recent call last):
 File "c_t.py", line xx, in setUp
 self.setupClass()
 File "c_t.py", line xxx, in TestSetup
 self.TestSetup()
 File "c_t.py", line xx, in corruptSetup
 sys.exit("/tmp is not mounted ...Exiting !!!")
SystemExit: /tmp is not mounted ...Exiting !!!
======================================================================
ERROR: test02
----------------------------------------------------------------------
Traceback (most recent call last):
 File "c_t.py", line 162, in test_02_hardlink_test
 self.inject_failures['test02']))
KeyError: 'test02'
Ran 2 tests in 0.003s
FAILED (errors=2)


More information about the Python-list mailing list

AltStyle によって変換されたページ (->オリジナル) /