|
@@ -35,6 +35,32 @@ class EntryPointTests(unittest.TestCase):
|
|
|
output = new_stdout.getvalue()
|
|
|
self.assertTrue(output.find('supervisord started') != 1, output)
|
|
|
|
|
|
+ def test_main_allows_injection_of_options_instance(self):
|
|
|
+ from supervisor.supervisord import main
|
|
|
+ from supervisor.options import ServerOptions
|
|
|
+ conf = os.path.join(
|
|
|
+ os.path.abspath(os.path.dirname(__file__)), 'fixtures',
|
|
|
+ 'donothing.conf')
|
|
|
+ import StringIO
|
|
|
+ new_stdout = StringIO.StringIO()
|
|
|
+ old_stdout = sys.stdout
|
|
|
+
|
|
|
+ options = ServerOptions()
|
|
|
+ self.assertFalse(hasattr(options, "args"))
|
|
|
+
|
|
|
+ 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'],
|
|
|
+ options=options, test=True)
|
|
|
+ finally:
|
|
|
+ sys.stdout = old_stdout
|
|
|
+ shutil.rmtree(tempdir)
|
|
|
+
|
|
|
+ self.assertTrue(hasattr(options, "args"))
|
|
|
+
|
|
|
if sys.version_info[:2] >= (2, 4):
|
|
|
def test_main_profile(self):
|
|
|
from supervisor.supervisord import main
|