How to use _read_pidfile method in autotest

Best Python code snippet using autotest_python

test_ia_client.py

Source:test_ia_client.py Github

copy

Full Screen

...28 Test that rabbitmq can be started29 @TODO This test should start/stop rabbitmq and couch in setup, as it leaves the system in a bad state.30 """31 self.ia_client.start_rabbitmq_server()32 pid = self.ia_client._read_pidfile(self.ia_client._pid_filename("rabbitmq"))33 self.assertTrue(pid)34 self.ia_client.start_rabbitmq_server()35 new_pid = self.ia_client._read_pidfile(self.ia_client._pid_filename("rabbitmq"))36 self.assertEqual(pid, new_pid)37 self.ia_client.stop_rabbitmq_server()38 pid = self.ia_client._read_pidfile(self.ia_client._pid_filename("rabbitmq"))39 self.assertFalse(pid)40 def test_container_couchdb(self):41 """Test that couchdb can be started"""42 self.ia_client.start_couchdb()43 pid = self.ia_client._read_pidfile(self.ia_client._pid_filename("couchdb"))44 self.assertTrue(pid)45 self.ia_client.start_couchdb()46 new_pid = self.ia_client._read_pidfile(self.ia_client._pid_filename("couchdb"))47 self.assertEqual(pid, new_pid)48 self.ia_client.stop_couchdb()49 pid = self.ia_client._read_pidfile(self.ia_client._pid_filename("couchdb"))50 self.assertFalse(pid)51 def test_container_start(self):52 """Test that a container can be started"""53 self.ia_client.start_container()54 self.assertTrue(self.ia_client.container)55 self.ia_client.stop_container()56 self.assertFalse(self.ia_client.container)57 def test_data_subscriber(self):58 """59 Test that we can build data subscribers using the packet config from the IDK60 """...

Full Screen

Full Screen

daemon.py

Source:daemon.py Github

copy

Full Screen

...21 os._exit(0)22 self._write_pidfile()23 self.onstart()24 def _stop(self):25 pid = self._read_pidfile()26 if pid != None and self._is_running(pid):27 os.kill(pid, signal.SIGTERM)28 while self._is_running(pid):29 time.sleep(0.1)30 else:31 raise Exception('Not running')32 def _restart(self):33 try:34 self._stop()35 except Exception:36 pass37 finally:38 self._start()39 def _is_running(self, pid = None):40 running = False41 if pid == None:42 pid = self._read_pidfile()43 if pid != None and os.path.isdir('/proc/{}'.format(pid)):44 running = True45 return running46 def _unknown_command(self):47 raise ValueError('Unknown command called')48 def _read_pidfile(self):49 pid = None50 if os.path.isfile(self.pidfile):51 fh = open(self.pidfile)52 spid = fh.read().strip()53 if spid.isdigit():54 pid = int(spid)55 return pid56 def _write_pidfile(self):...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run autotest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful