• import sys ,unittest
    reload(sys)
    sys.setdefaultencoding("utf-8")
    class A(unittest.TestCase):
        result = {'test_001':False}
        @classmethod
        def setUpClass(cls):
            super(A, cls).setUpClass()
        def test_001(self):
            self.result['test_001'] = True
    
            print self.result
        #@unittest.skipIf(result['a'] == 4, '跳过')
        def test_002(self):
            if self.result['test_001'] == True:
                return
            print 'test_002'
    if __name__ == '__main__':
        unittest.main()
    
  • 我是这样实现的
    import sys ,unittest
    reload(sys)
    sys.setdefaultencoding("utf-8")
    class A(unittest.TestCase):
    result = {'test_001':False}
    @classmethod
    def setUpClass(cls):
    super(A, cls).setUpClass()
    def test_001(self):
    self.result['test_001'] = True

    print self.result
    #@unittest.skipIf(result['a'] == 4, '跳过')
    def test_002(self):
    if self.result['test_001'] == True:
    return
    print 'test_002'
    if name == 'main':
    unittest.main()

  • 对在 web 页面提交 并出报告比较有兴趣