예제 #1
0
 def test_removes_standard_files(self):
     """ become_daemon should request removal of standard files """
     expect_mock_output = """\
         ...
         Called server.remove_standard_files()
         """
     server.become_daemon()
     self.failUnlessOutputCheckerMatch(expect_mock_output,
                                       self.mock_outfile.getvalue())
예제 #2
0
 def test_child_starts_new_process_group(self):
     """ become_daemon child should start new process group """
     expect_mock_output = """\
         Called os.fork()
         Called os.setsid()
         ...
         """
     server.become_daemon()
     self.failUnlessOutputCheckerMatch(expect_mock_output,
                                       self.mock_outfile.getvalue())
예제 #3
0
 def test_removes_standard_files(self):
     """ become_daemon should request removal of standard files """
     expect_mock_output = """\
         ...
         Called server.remove_standard_files()
         """
     server.become_daemon()
     self.failUnlessOutputCheckerMatch(
         expect_mock_output, self.mock_outfile.getvalue()
         )
예제 #4
0
 def test_child_forks_next_child_continues(self):
     """ become_daemon should fork, then continue if child """
     expect_mock_output = """\
         Called os.fork()
         Called os.setsid()
         Called os.fork()
         Called server.remove_standard_files()
         """
     server.become_daemon()
     self.failUnlessOutputCheckerMatch(expect_mock_output,
                                       self.mock_outfile.getvalue())
예제 #5
0
 def test_child_starts_new_process_group(self):
     """ become_daemon child should start new process group """
     expect_mock_output = """\
         Called os.fork()
         Called os.setsid()
         ...
         """
     server.become_daemon()
     self.failUnlessOutputCheckerMatch(
         expect_mock_output, self.mock_outfile.getvalue()
         )
예제 #6
0
 def test_child_forks_next_child_continues(self):
     """ become_daemon should fork, then continue if child """
     expect_mock_output = """\
         Called os.fork()
         Called os.setsid()
         Called os.fork()
         Called server.remove_standard_files()
         """
     server.become_daemon()
     self.failUnlessOutputCheckerMatch(
         expect_mock_output, self.mock_outfile.getvalue()
         )
예제 #7
0
 def test_parent_exits(self):
     """ become_daemon parent process should exit """
     parent_pid = 23
     scaffold.mock("os.fork",
                   returns_iter=[parent_pid],
                   outfile=self.mock_outfile)
     expect_mock_output = """\
         Called os.fork()
         Called os._exit(0)
         ...
         """
     server.become_daemon()
     self.failUnlessOutputCheckerMatch(expect_mock_output,
                                       self.mock_outfile.getvalue())
예제 #8
0
 def test_parent_exits(self):
     """ become_daemon parent process should exit """
     parent_pid = 23
     scaffold.mock("os.fork", returns_iter=[parent_pid],
         outfile=self.mock_outfile)
     expect_mock_output = """\
         Called os.fork()
         Called os._exit(0)
         ...
         """
     server.become_daemon()
     self.failUnlessOutputCheckerMatch(
         expect_mock_output, self.mock_outfile.getvalue()
         )
예제 #9
0
 def test_child_forks_next_parent_exits(self):
     """ become_daemon should fork, then exit if parent """
     test_pids = [0, 42]
     scaffold.mock("os.fork",
                   returns_iter=test_pids,
                   outfile=self.mock_outfile)
     expect_mock_output = """\
         Called os.fork()
         Called os.setsid()
         Called os.fork()
         Called os._exit(0)
         ...
         """
     server.become_daemon()
     self.failUnlessOutputCheckerMatch(expect_mock_output,
                                       self.mock_outfile.getvalue())
예제 #10
0
 def test_child_forks_next_parent_exits(self):
     """ become_daemon should fork, then exit if parent """
     test_pids = [0, 42]
     scaffold.mock("os.fork", returns_iter=test_pids,
         outfile=self.mock_outfile)
     expect_mock_output = """\
         Called os.fork()
         Called os.setsid()
         Called os.fork()
         Called os._exit(0)
         ...
         """
     server.become_daemon()
     self.failUnlessOutputCheckerMatch(
         expect_mock_output, self.mock_outfile.getvalue()
         )