def test_spawn_process(): p = shell.spawn_process(add, args=(23, 2)) p.join() assert p.exitcode == 0 p = shell.spawn_process(add, join=True, args=(23, 2)) assert p.exitcode == 0
def test_spawn_process(self): p = shell.spawn_process(add, args=(23, 2)) p.join() self.eq(p.exitcode, 0) p = shell.spawn_process(add, join=True, args=(23, 2)) self.eq(p.exitcode, 0)
def test_daemon(self): (_, tmpfile) = tempfile.mkstemp() os.remove(tmpfile) from cement.utils import shell # Test in a sub-process to avoid Nose hangup def target(): app = self.make_app('test', argv=['--daemon'], extensions=['daemon']) app.setup() app.config.set('daemon', 'pid_file', tmpfile) try: # FIX ME: Can't daemonize, because nose loses sight of it app.daemonize() app.run() finally: app.close() ext_daemon.cleanup(app) p = shell.spawn_process(target) p.join() self.eq(p.exitcode, 0)
def test_daemon(tmp): os.remove(tmp.file) from cement.utils import shell # Test in a sub-process to avoid hangup def target(): with TestApp(argv=['--daemon'], extensions=['daemon']) as app: app.config.set('daemon', 'pid_file', tmp.file) try: # FIX ME: Can't daemonize, because nose/pytest lose sight of it app.daemonize() app.run() finally: app.close() ext_daemon.cleanup(app) p = shell.spawn_process(target) p.join() assert p.exitcode == 0
def test_daemon(self): os.remove(self.tmp_file) from cement.utils import shell # Test in a sub-process to avoid Nose hangup def target(): app = self.make_app('test', argv=['--daemon'], extensions=['daemon']) app.setup() app.config.set('daemon', 'pid_file', self.tmp_file) try: # FIX ME: Can't daemonize, because nose loses sight of it app.daemonize() app.run() finally: app.close() ext_daemon.cleanup(app) p = shell.spawn_process(target) p.join() self.eq(p.exitcode, 0)