【发布时间】:2020-05-17 05:00:27
【问题描述】:
项目结构:
/prj_root
|
|___some_test.py
|
|___main.py
我用pytest写了以下测试:
some_test.py:
def test_something(entty):
#Some pytest code
和下面的脚本
main.py:
@dataclass
class Entity(object):
name: str
if __name__=='__main__':
entity = Entity(name = 'some_stub_value')
#Here I want to invoke pytest's test_something test method
#with entity passed as an argument
有没有办法从 python 脚本将参数传递给pytest 的测试方法?
【问题讨论】:
标签: python python-3.x pytest python-3.7 python-dataclasses