开发者

Possible to use unittest-like fixtures in py.test?

开发者 https://www.devze.com 2023-01-16 23:53 出处:网络
I really like py.test, but I am having lots of difficulty understanding how funcargs work. Is it possible to use a command line argument or an extension to enable the use of s开发者_如何学运维omethi

I really like py.test, but I am having lots of difficulty understanding how funcargs work.

Is it possible to use a command line argument or an extension to enable the use of s开发者_如何学运维omething that performs a similar role to unittest.TestCase.setUp and unittest.TestCase.tearDown?


py.test supports "normal" xunit method-based fixtures by default, see:

http://codespeak.net/py/dist/test/xunit_setup.html

Alternatively you can subclass from unittest.TestCase and use .setUp/tearDown but the latter may be a bit limited.

0

精彩评论

暂无评论...
验证码 换一张
取 消