pytest框架(三)

pytharm运行三种方式

代码示例:

 1 # coding=utf-8
 2 import pytest
 3 
 4 
 5 class TestClass:
 6     def test_one(self):
 7         x = "this"
 8         assert 'h' in x
 9 
10     def test_two(self):
11         x = "hello"
12         assert hasattr(x, 'check')
13 
14     def test_three(self):
15         a = "hello"
16         b = "hello world"
17         assert a in b
18 
19 
20 if __name__=="__main__":
21     pytest.main(['-q', 'test_class.py'])

 

posted @ 2018-08-22 19:18  小白2510  阅读(210)  评论(0编辑  收藏  举报