Browse Source

Coverage: can't find default config file behavior

Nick Pilon 11 years ago
parent
commit
2c204fd6f6
1 changed files with 13 additions and 0 deletions
  1. 13 0
      supervisor/tests/test_options.py

+ 13 - 0
supervisor/tests/test_options.py

@@ -141,6 +141,19 @@ class OptionTests(unittest.TestCase):
         options._set('foo', 'gazonk', 1)
         self.assertEqual(options.foo, 'gazonk')
 
+    def test_missing_default_config(self):
+        options = self._makeOptions()
+        options.searchpaths = [missing_but_potential_file()]
+        options.exit = dummy_exit()
+        options.stderr = StringIO()
+        try:
+            options.default_configfile()
+        except DummyExitException as e:
+            self.assertEqual(e.exitcode, 2)
+        else:
+            self.fail("expected exception")
+        self.assertTrue(options.stderr.getvalue().startswith("Error: No config file found at default paths"))
+
 class ClientOptionsTests(unittest.TestCase):
     def _getTargetClass(self):
         from supervisor.options import ClientOptions