本文整理汇总了Python中testify.run函数的典型用法代码示例。如果您正苦于以下问题:Python run函数的具体用法?Python run怎么用?Python run使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了run函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestDiscoverIgnoreImportedThings
class TestDiscoverIgnoreImportedThings(DiscoveryTestCase):
def test_imported_things_are_ignored(self):
discovered_imported = list(test_discovery.discover("test.test_suite_subdir.import_testcase"))
discovered_actually_defined_in_module = list(test_discovery.discover("test.test_suite_subdir.define_testcase"))
assert_length(discovered_imported, 0)
assert_length(discovered_actually_defined_in_module, 1)
class ImportTestClassCase(DiscoveryTestCase):
def discover(self, module_path, class_name):
return test_discovery.import_test_class(module_path, class_name)
def test_discover_testify_case(self):
assert self.discover("test.test_suite_subdir.define_testcase", "DummyTestCase")
def test_discover_unittest_case(self):
assert self.discover("test.test_suite_subdir.define_unittestcase", "TestifiedDummyUnitTestCase")
def test_discover_bad_case(self):
assert_raises(test_discovery.DiscoveryError, self.discover, "bad.subdir", "DummyTestCase")
assert_raises(
test_discovery.DiscoveryError, self.discover, "test.test_suite_subdir.define_testcase", "IGNORE ME"
)
if __name__ == "__main__":
run()
# vim: set ts=4 sts=4 sw=4 et:
示例2: PushesTemplateTest
from pushmanager.testing.testservlet import TemplateTestCase
class PushesTemplateTest(TemplateTestCase):
authenticated = True
pushes_page = 'pushes.html'
new_push_page = 'new-push.html'
def render_pushes_page(self, page_title='Pushes', pushes=[], pushes_per_page=50, last_push=None):
return self.render_etree(self.pushes_page,
page_title=page_title,
pushes=pushes,
rpp=pushes_per_page,
last_push=last_push
)
def test_include_new_push(self):
tree = self.render_pushes_page()
found_form = []
for form in tree.iter('form'):
if form.attrib['id'] == 'push-info-form':
found_form.append(form)
T.assert_equal(len(found_form), 1)
if __name__ == '__main__':
T.run()
示例3: test_custom_mode
testify.assert_equal(self.get_perm_mask(self.path), 0666)
def test_custom_mode(self):
# Turn off umask
os.umask(0000)
# Create a db with a custom mode
mode = 0600
sqlite3dbm.dbm.SqliteMap(self.path, flag='c', mode=mode)
testify.assert_equal(self.get_perm_mask(self.path), mode)
def test_respects_umask(self):
mode = 0777
umask = 0002
os.umask(umask)
expected_mode = mode & ~umask
sqlite3dbm.dbm.SqliteMap(self.path, flag='c', mode=mode)
testify.assert_equal(self.get_perm_mask(self.path), expected_mode)
class SanityCheckOpen(SqliteCreationTest):
def test_open_creates(self):
smap = sqlite3dbm.dbm.open(self.path, flag='c')
smap['foo'] = 'bar'
testify.assert_equal(smap['foo'], 'bar')
if __name__ == '__main__':
testify.run()