def test_stop_command(): # gave a bad pid file try: commands.stop_command(pid="run/dontexit.pid") except IOError: assert sys.exit.called make_fake_pid_file() commands.stop_command(pid="run/fake.pid") make_fake_pid_file() commands.stop_command(ALL="run") make_fake_pid_file() commands.stop_command(pid="run/fake.pid", KILL=True) assert os.kill.called assert not os.path.exists("run/fake.pid") make_fake_pid_file() os.kill.side_effect = raise_OSError commands.stop_command(pid="run/fake.pid", KILL=True)
def handle(self, *args, **options): commands.stop_command(options['pid'], options['kill'], options['all'], )
def handle(self, *args, **options): commands.stop_command( options['pid'], options['kill'], options['all'], )