Ejemplo n.º 1
0
 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
     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'], test=True)
     finally:
         sys.stdout = old_stdout
         shutil.rmtree(tempdir)
     output = new_stdout.getvalue()
     self.assertTrue('supervisord started' in output, output)
Ejemplo n.º 2
0
 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)
Ejemplo n.º 3
0
 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)
Ejemplo n.º 4
0
 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
     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',
             '--profile_options=cumulative,calls'
         ],
              test=True)
     finally:
         sys.stdout = old_stdout
         shutil.rmtree(tempdir)
     output = new_stdout.getvalue()
     self.assertTrue(
         output.find('cumulative time, call count') != -1, output)