Ejemplo n.º 1
0
 def test_daemon_posix(self):
     """Testing daemon.posix: parent behaviour"""
     d = Daemon.create(lambda: None, lambda: None)
     d.foreground()
     os.fork = lambda: 0
     d.start()
     d.restart()
Ejemplo n.º 2
0
 def test_daemon_posix_child(self):
     """Testing daemon.posix: child behaviour"""
     d = Daemon.create(lambda: None, lambda: None)
     os.fork = lambda: 100
     os.kill = lambda x, y: None
     d.start()
     assert d.pid == 100
     d.stop()
     assert d.pid == 0
Ejemplo n.º 3
0
 def test_daemon_posix(self):
     """Testing Daemon: posix"""
     os.name = 'posix'
     Daemon.create(lambda: None)
Ejemplo n.º 4
0
 def test_daemon(self):
     """Testing Daemon: invalid platform"""
     os.name = 'foo'
     with self.assertRaises(NotImplementedError):
         Daemon.create(lambda: None)