Best Python code snippet using tempest_python
checks.py
Source:checks.py
...109 """110 if TESTTOOLS_SKIP_DECORATOR.match(logical_line):111 yield (0, "T109: Cannot use testtools.skip decorator; instead use "112 "decorators.skip_because from tempest-lib")113def _common_service_clients_check(logical_line, physical_line, filename,114 ignored_list_file=None):115 if 'tempest/services/' not in filename:116 return False117 if ignored_list_file is not None:118 ignored_list = []119 with open('tempest/hacking/' + ignored_list_file) as f:120 for line in f:121 ignored_list.append(line.strip())122 if filename in ignored_list:123 return False124 if not METHOD.match(physical_line):125 return False126 if pep8.noqa(physical_line):127 return False128 return True129def get_resources_on_service_clients(logical_line, physical_line, filename,130 line_number, lines):131 """Check that service client names of GET should be consistent132 T110133 """134 if not _common_service_clients_check(logical_line, physical_line,135 filename, 'ignored_list_T110.txt'):136 return137 for line in lines[line_number:]:138 if METHOD.match(line) or CLASS.match(line):139 # the end of a method140 return141 if 'self.get(' not in line and ('self.show_resource(' not in line and142 'self.list_resources(' not in line):143 continue144 if METHOD_GET_RESOURCE.match(logical_line):145 return146 msg = ("T110: [GET /resources] methods should be list_<resource name>s"147 " or show_<resource name>")148 yield (0, msg)149def delete_resources_on_service_clients(logical_line, physical_line, filename,150 line_number, lines):151 """Check that service client names of DELETE should be consistent152 T111153 """154 if not _common_service_clients_check(logical_line, physical_line,155 filename, 'ignored_list_T111.txt'):156 return157 for line in lines[line_number:]:158 if METHOD.match(line) or CLASS.match(line):159 # the end of a method160 return161 if 'self.delete(' not in line and 'self.delete_resource(' not in line:162 continue163 if METHOD_DELETE_RESOURCE.match(logical_line):164 return165 msg = ("T111: [DELETE /resources/<id>] methods should be "166 "delete_<resource name>")167 yield (0, msg)168def factory(register):...
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!!