def start_process(self): self.stdout.write('>>> Starting watcher') cmd = watch_command() self.process = subprocess.Popen( [cmd], shell=True, stdin=subprocess.PIPE, stdout=self.stdout, stderr=self.stderr) if self.process.poll() is not None: raise CommandError('watcher failed to start') self.stdout.write('>>> watcher process on pid {0}' .format(self.process.pid)) atexit.register(self.kill_process) self.process.wait() if self.process.returncode != 0 and not self.cleanup_closing: raise CommandError('watcher exited unexpectedly')
def test_custom_watch_command(self): with self.settings(WATCH_COMMAND=CustomTestCase.COMMAND): self.assertEqual(CustomTestCase.COMMAND, core.watch_command())
def test_watch_command(self): self.assertEqual(self.command, core.watch_command())