Best Python code snippet using Airtest
apache_http_unittest.py
Source:apache_http_unittest.py
...32from blinkpy.common.host_mock import MockHost33from blinkpy.web_tests.port import test34from blinkpy.web_tests.servers.apache_http import ApacheHTTP35class TestApacheHTTP(unittest.TestCase):36 def test_start_cmd(self):37 # Fails on win - see https://bugs.webkit.org/show_bug.cgi?id=8472638 if sys.platform == 'win32':39 return40 def fake_pid(_):41 host.filesystem.write_text_file('/tmp/WebKit/httpd.pid', '42')42 return True43 host = MockHost()44 host.executive = MockExecutive(should_log=True)45 test_port = test.TestPort(host)46 host.filesystem.write_text_file(test_port.path_to_apache_config_file(), '')47 server = ApacheHTTP(test_port, '/mock/output_dir', additional_dirs=[], number_of_servers=4)48 server._check_that_all_ports_are_available = lambda: True49 server._is_server_running_on_all_ports = lambda: True50 server._wait_for_action = fake_pid...
test_distribution_rpm.py
Source:test_distribution_rpm.py
...25 self.distribution_rpm.install("opensearch.rpm")26 args_list = check_call_mock.call_args_list27 self.assertEqual(check_call_mock.call_count, 1)28 self.assertEqual("yum remove -y opensearch && yum install -y opensearch.rpm", args_list[0][0][0])29 def test_start_cmd(self) -> None:30 self.assertEqual(self.distribution_rpm.start_cmd, "systemctl start opensearch")31 self.assertEqual(self.distribution_rpm_dashboards.start_cmd, "systemctl start opensearch-dashboards")32 @patch("subprocess.check_call")33 def test_uninstall(self, check_call_mock: Mock) -> None:34 self.distribution_rpm.uninstall()35 args_list = check_call_mock.call_args_list36 self.assertEqual(check_call_mock.call_count, 1)...
test_comm_cps.py
Source:test_comm_cps.py
...6comun = communication.CommunicationOnSerial(STM_COMMUNICATION_DEVICE)7comun.enable_debugging()8comun.activate_connection()9print('Start')10def test_start_cmd():11 comun.on_start()12count = 1013time = timeit.timeit(test_start_cmd, number=count)14print(time/count)15# for i in range(10):16# test_start_cmd()17 18# inp = comun.get_debug_line()19# if inp:...
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!