本文整理汇总了Python中tests.unit.unittest.main函数的典型用法代码示例。如果您正苦于以下问题:Python main函数的具体用法?Python main怎么用?Python main使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了main函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ScarlettSystemTestCase
class ScarlettSystemTestCase(ScarlettTestCase):
def setUp(self):
super(ScarlettSystemTestCase, self).setUp()
@attr(scarlettsystem=True, dbus=True)
def test_scarlett_system(self):
ss_test = scarlett.ScarlettSystem()
self.assertTrue(
'Scarlett 0.5.0 (linux2)' in ss_test.scarlett_version_info, True)
self.assertTrue('Python 2.7.3' in ss_test.scarlett_version_info, True)
self.assertTrue('PyGst 0.10' in ss_test.scarlett_version_info, True)
self.assertTrue(
'Gobject (2, 32, 4)' in ss_test.scarlett_version_info, True)
self.assertTrue(
'org.scarlettapp.scarlettdaemon' in ss_test.DBUS_NAME, True)
self.assertTrue(
'/org/scarlettapp/scarlettdaemon' in ss_test.DBUS_PATH, True)
self.assertEqual(ss_test.brain, None)
self.assertEqual(ss_test.player, None)
self.assertEqual(ss_test.speaker, None)
self.assertEqual(ss_test.base_services, [])
self.assertEqual(ss_test.features, [])
def suite():
return unittest.TestLoader().loadTestsFromName(__name__)
if __name__ == '__main__':
unittest.main(defaultTest='suite')
示例2: test_cancel_export_task
self.set_http_response(status_code=200)
tasks = self.service_connection.describe_export_tasks([self.TASK_ID])
self.assert_request_parameters({
"Action": "DescribeExportTasks",
"ExportTaskId.1": "i-task"
}, self.ignore_params_values)
self.assertEquals(len(tasks), 1)
task = tasks[0]
self.assertIsInstance(task, ExportTask)
self.assertEquals(task.id, self.TASK_ID)
self.assertEquals(task.instance_id, "i-instance")
self.assertEquals(len(task.volume_export_details), 1)
volume = task.volume_export_details[0]
self.assertIsInstance(volume, ExportVolumeTask)
self.assertEquals(volume.volume_id, "i-volume")
def test_cancel_export_task(self):
self.set_http_response(status_code=200)
resp = self.service_connection.cancel_export_task(self.TASK_ID)
self.assert_request_parameters({
"Action": "CancelExportTask",
"ExportTaskId": "i-task"
}, self.ignore_params_values)
self.assertTrue(resp)
if __name__ == "__main__":
unittest.main()
示例3: TestDescribeInstances
# id of the ec2 instance).
self.assertEqual(instance.id, 'i-ff0f1299')
self.assertDictEqual(
instance.instance_profile,
{'arn': ('arn:aws:iam::ownerid:'
'instance-profile/myinstanceprofile'),
'id': 'iamid'})
class TestDescribeInstances(AWSMockServiceTestCase):
connection_class = EC2Connection
def default_body(self):
return DESCRIBE_INSTANCE_VPC
def test_multiple_private_ip_addresses(self):
self.set_http_response(status_code=200)
api_response = self.service_connection.get_all_instances()
self.assertEqual(len(api_response), 1)
instances = api_response[0].instances
self.assertEqual(len(instances), 1)
instance = instances[0]
self.assertEqual(len(instance.interfaces), 1)
interface = instance.interfaces[0]
self.assertEqual(len(interface.private_ip_addresses), 3)
addresses = interface.private_ip_addresses
self.assertEqual(addresses[0].private_ip_address, '10.0.0.67')
self.assertTrue(addresses[0].primary)
self.assertEqual(addresses[1].private_ip_address, '10.0.0.54')
self.assertFalse(addresses[1].primary)
self.assertEqual(addresses[2].private_ip_address, '10.0.0.55')
self.assertFalse(addresses[2].primary)
if __name__ == '__main__':
unittest.main(