标签:框架 完成 ror splay 高级功能 sam style wrap 模块
# -*- coding: utf-8 -*-
# @Time : 2018/7/5 23:57
# @Author : onesilent
# @File : FirstTest.py
# @Project : PythonTestDemo
# content of test_sample.py
def func(x):
return x + 1
def test_answer():
assert func(3) == 5
# -*- coding: utf-8 -*-
# @Time : 2018/7/10 23:29
# @Author : onesilent
# @File : test_sysexit.py
# @Project : PythonTestDemo
# content of test_sysexit.py
import pytest
def f():
raise SystemExit(1)
def test_mytest():
with pytest.raises(SystemExit):
f()
# -*- coding: utf-8 -*-
# @Time : 2018/7/11 0:00
# @Author : onesilent
# @File : test_class.py
# @Project : PythonTestDemo
# content of test_class.py
class TestClass(object):
def test_one(self):
x = "this"
assert ‘h‘ in x
def test_two(self):
x = "hello"
assert hasattr(x, ‘check‘)
# -*- coding: utf-8 -*-
# @Time : 2018/7/11 23:57
# @Author : onesilent
# @File : test_tmpdir.py
# @Project : PythonTestDemo
# content of test_tmpdir.py
def test_needsfiles(tmpdir):
print (tmpdir)
assert 0
pytest --fixtures #此命令显示内置命令和custom fixtures 请注意,除非添加-v选项,否则此命令将省略带有前导_的 fixtures。
标签:框架 完成 ror splay 高级功能 sam style wrap 模块
原文地址:https://www.cnblogs.com/onesilent/p/9298202.html