当前位置: 动力学知识库 > 问答 > 编程问答 >

python - Running a method just once at the beginning before any tests are run in PyUnit

问题描述:

Im using PyUnit to write unit tests for my code. The setup method is called everytime before any test is run.

Is there a way i can define a method that will be run just once at the beginning before any tests are run ?

Please Help

Thank You

网友答案:

You can use setUpClass or setUpModule in Python 2.7 and 3.2.

网友答案:

How about using the constructor of your test class?

分享给朋友:
您可能感兴趣的文章:
随机阅读: