本文整理汇总了Python中nose2.main函数的典型用法代码示例。如果您正苦于以下问题:Python main函数的具体用法?Python main怎么用?Python main使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了main函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Test
import nose2
import unittest
import logging
log = logging.getLogger(__name__)
class Test(unittest.TestCase):
def test_logging_config(self):
log.debug("foo")
log.info("bar")
assert False
if __name__ == '__main__':
nose2.main()
示例2: aubio_cmd
import aubio.cmd
from nose2 import main
from numpy.testing import TestCase
class aubio_cmd(TestCase):
def setUp(self):
self.a_parser = aubio.cmd.aubio_parser()
def test_default_creation(self):
try:
assert self.a_parser.parse_args(['-V']).show_version
except SystemExit:
url = 'https://bugs.python.org/issue9253'
self.skipTest('subcommand became optional in py3, see %s' % url)
class aubio_cmd_utils(TestCase):
def test_samples2seconds(self):
self.assertEqual(aubio.cmd.samples2seconds(3200, 32000), "0.100000\t")
def test_samples2milliseconds(self):
self.assertEqual(aubio.cmd.samples2milliseconds(3200, 32000), "100.000000\t")
def test_samples2samples(self):
self.assertEqual(aubio.cmd.samples2samples(3200, 32000), "3200\t")
if __name__ == '__main__':
main()
示例3: test_cache_expiration
def test_cache_expiration(self):
from qualysapi import api_objects
mymap = api_objects.Map(
name = 'Bogus Test Map',
ref = 'map/12345.bogus',
date = '2015-11-19T06:00:39Z',
status = 'Finished',
report_id = None,
)
self.cache_instance.cache_api_object(obj=mymap, expiration=1)
# sleep for 2 seconds, letting the cache expire the key after 1
import time
time.sleep(2)
fromcache = self.cache_instance.load_api_object(
objkey = mymap.getKey(),
objtype = api_objects.Map
)
self.assertIsNone(fromcache)
def test_speed(self):
self.assertTrue(False)
#stand-alone test execution
if __name__ == '__main__':
import nose2
nose2.main(argv=['fake', '--log-capture'])
示例4: run_from_argv
def run_from_argv(self, argv):
import nose2
with run_tests():
nose2.main(module=None, argv=argv[1:])