首先,我是GAE/Python的新手,请耐心等待。情况是这样的
我有一个test_all.py来测试我包中的所有测试套件。测试用例的setUp电流看起来像;
import test_settings as policy # has consistency variables <- does not work
...
def setUp(self):
# First, create an instance of the Testbed class.
self.testbed = testbed.Testbed()
# Then activate the testbed, which prepares the service stubs for use.
self.testbed.activate()
# Consistency policy nomal operations
self.policy = None
if policy.policy_flag == 'STRICT':
# Create a consistency policy that will simulate the High Replication consistency model.
self.policy = datastore_stub_util.PseudoRandomHRConsistencyPolicy(probability=0)
# Initialize the datastore stub with this policy.
self.testbed.init_datastore_v3_stub(consistency_policy=self.policy)这是我的原始尝试,使用不同的一致性策略来设置数据存储,以便对它们运行测试。完全失败。
我想要的是使用上面或其他方法从根test_all.py一次性运行不同数据存储一致性的测试用例,我如何做到这一点?如何将参数从测试运行器传递到TestCase?
发布于 2013-05-16 13:49:02
Python, unit test - Pass command line arguments to setUp of unittest.TestCase
上面的线程准确地展示了如何最好地将运行时参数传递给测试用例。具体回答2。
https://stackoverflow.com/questions/16556552
复制相似问题