V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
shylockhg
V2EX  ›  问与答

写了一个简单 Python 测试脚本,请问一下为什么运行显示测试用例为 0,我这里已经定义一个了吧

  •  1
     
  •   shylockhg · Dec 4, 2018 · 1384 views
    This topic created in 2706 days ago, the information mentioned may be changed or developed.
    import unittest                                                                                     
                                                                                                         
    from viman import vimanApp                                                                          
                                                                                                         
    class cli_tests(unittest.TestCase):                                                                 
        argv_set = [                                                                                    
                ['viman', '-h'],                                                                        
                ['viman', '-V'],                                                                        
                ['viman', '-Q'],                                                                        
                ['viman', '-Sf', 'test.yml'],                                                           
                ['viman', '-S', 'https://github.com/vimscript/vim-snippets.git'],   
                ['viman', '-Ur'],                                                                       
                ['viman', '-R', 'https://github.com/vimscript/vim-snippets.git'],   
                ['viman', '-Rn', 'a.vim'],                                                              
                ['viman', '-Rf', '~/.viman.yml'],                                                       
            ]                                                                                           
                                                                                                        
        def cli_testing(self):                                                                          
            for argv in cli_tests.argv_set:                                                             
                self.assertEqual(vimanApp.main(argv), 0)                                                
                                                                                                        
                                                                                                        
    if __name__ == '__main__':                                                                          
        unittest.main()
    
    1 replies    2018-12-04 11:38:04 +08:00
    shylockhg
        1
    shylockhg  
    OP
       Dec 4, 2018
    呵呵, 好吧 测试函数要 test_.+形式,真是服了
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2372 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 04:23 · PVG 12:23 · LAX 21:23 · JFK 00:23
    ♥ Do have faith in what you're doing.