本文整理汇总了Python中supervisor.compat.StringIO.fileno方法的典型用法代码示例。如果您正苦于以下问题:Python StringIO.fileno方法的具体用法?Python StringIO.fileno怎么用?Python StringIO.fileno使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类supervisor.compat.StringIO
的用法示例。
在下文中一共展示了StringIO.fileno方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_main_noprofile
# 需要导入模块: from supervisor.compat import StringIO [as 别名]
# 或者: from supervisor.compat.StringIO import fileno [as 别名]
def test_main_noprofile(self):
from supervisor.supervisord import main
conf = os.path.join(
os.path.abspath(os.path.dirname(__file__)), 'fixtures',
'donothing.conf')
new_stdout = StringIO()
new_stdout.fileno = lambda: 1
old_stdout = sys.stdout
tempdir = tempfile.mkdtemp()
try:
log = os.path.join(tempdir, 'log')
pid = os.path.join(tempdir, 'pid')
sys.stdout = new_stdout
main(args=['-c', conf, '-l', log, '-j', pid, '-n'],
test=True)
finally:
sys.stdout = old_stdout
shutil.rmtree(tempdir)
output = new_stdout.getvalue()
self.assertTrue(output.find('supervisord started') != 1, output)
示例2: test_main_profile
# 需要导入模块: from supervisor.compat import StringIO [as 别名]
# 或者: from supervisor.compat.StringIO import fileno [as 别名]
def test_main_profile(self):
from supervisor.supervisord import main
conf = os.path.join(
os.path.abspath(os.path.dirname(__file__)), 'fixtures',
'donothing.conf')
new_stdout = StringIO()
new_stdout.fileno = lambda: 1
old_stdout = sys.stdout
try:
tempdir = tempfile.mkdtemp()
log = os.path.join(tempdir, 'log')
pid = os.path.join(tempdir, 'pid')
sys.stdout = new_stdout
main(args=['-c', conf, '-l', log, '-j', pid, '-n',
'--profile_options=cumulative,calls'], test=True)
finally:
sys.stdout = old_stdout
shutil.rmtree(tempdir)
output = new_stdout.getvalue()
self.assertTrue('cumulative time, call count' in output, output)