From b9ac2b93455399c3eb4b99b3e8b0ab3aa3274e69 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Fri, 7 Oct 2011 08:54:39 -0400 Subject: add some more pserve tests --- pyramid/scripts/pserve.py | 2 +- pyramid/tests/test_scripts/test_pserve.py | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/pyramid/scripts/pserve.py b/pyramid/scripts/pserve.py index de5276a9f..ffb6b229b 100644 --- a/pyramid/scripts/pserve.py +++ b/pyramid/scripts/pserve.py @@ -333,7 +333,7 @@ class PServeCommand(object): result[name] = value return result - def quote_first_command_arg(self, arg): + def quote_first_command_arg(self, arg): # pragma: no cover """ There's a bug in Windows when running an executable that's located inside a path with a space in it. This method handles diff --git a/pyramid/tests/test_scripts/test_pserve.py b/pyramid/tests/test_scripts/test_pserve.py index bc2e9aac8..38f7d2666 100644 --- a/pyramid/tests/test_scripts/test_pserve.py +++ b/pyramid/tests/test_scripts/test_pserve.py @@ -1,4 +1,5 @@ import unittest +import os class TestPServeCommand(unittest.TestCase): def setUp(self): @@ -25,3 +26,16 @@ class TestPServeCommand(unittest.TestCase): self.assertEqual(result, None) self.assertEqual(self.out_.getvalue(), 'You must give a config file') + def test_stop_daemon_no_such_pid_file(self): + path = os.path.join(os.path.dirname(__file__), 'wontexist.pid') + inst = self._makeOne('--stop-daemon', '--pid-file=%s' % path) + inst.run() + self.assertEqual(self.out_.getvalue(),'No PID file exists in %s' % path) + + def test_stop_daemon_bad_pid_file(self): + path = __file__ + inst = self._makeOne('--stop-daemon', '--pid-file=%s' % path) + inst.run() + self.assertEqual( + self.out_.getvalue(),'Not a valid PID file in %s' % path) + -- cgit v1.2.3