Is there a way to use Python unit test assertions outside of a TestCase?

后端 未结 2 1995
说谎
说谎 2020-12-06 08:45

I need to create a fake helper class to be used in unit tests (injected into tested classes). Is there some way to use TestCase assertions in such class?

I would lik

2条回答
  •  悲&欢浪女
    2020-12-06 09:42

    You can use Pytest or Nosetest. Though I'don't know if they have 'assertNotNull' function. I know they can use 'assert' simply for assertion. Or you can use something like assertpy or ptest, if you like, you can search for them on github.

提交回复
热议问题