Best Python code snippet using avocado_python
find_clash_cluster.py
Source:find_clash_cluster.py
...133 finally returns some key figures of the crash analysis.134 """135 crashes1 = read_crashes(136 fuzzer1,137 get_crash_dir(crash_root, fuzzer1, target, seed),138 max_no_of_crashes,139 n_frames,140 )141 crashes2 = read_crashes(142 fuzzer2,143 get_crash_dir(crash_root, fuzzer2, target, seed),144 max_no_of_crashes,145 n_frames,146 )147 if len(crashes1 + crashes2) == 0:148 cluster_ids1 = set()149 cluster_ids2 = set()150 else:151 try:152 cluster_dict = _get_diff_crash_cov(153 fuzzer1, crashes1, fuzzer2, crashes2, epsilon, metric["function"]154 )155 cluster_ids1 = cluster_dict[fuzzer1]156 cluster_ids2 = cluster_dict[fuzzer2]157 if draw_venn:...
main.py
Source:main.py
...22 "your installation, and if necessary reinstall it.\n")23 # This exit code is replicated from avocado/core/exit_codes.py and not24 # imported because we are dealing with import failures25 sys.exit(-1)26def get_crash_dir():27 crash_dir_path = os.path.join(data_dir.get_data_dir(), "crashes")28 try:29 os.makedirs(crash_dir_path)30 except OSError:31 pass32 return crash_dir_path33def handle_exception(*exc_info):34 # Print traceback if AVOCADO_LOG_DEBUG environment variable is set35 msg = "Avocado crashed:\n" + "".join(traceback.format_exception(*exc_info))36 msg += "\n"37 if os.environ.get("AVOCADO_LOG_DEBUG"):38 os.write(2, msg.encode('utf-8'))39 # Store traceback in data_dir or TMPDIR40 prefix = "avocado-traceback-"41 prefix += time.strftime("%F_%T") + "-"42 tmp, name = tempfile.mkstemp(".log", prefix, get_crash_dir())43 os.write(tmp, msg.encode('utf-8'))44 os.close(tmp)45 # Print friendly message in console-like output46 msg = ("Avocado crashed unexpectedly: %s\nYou can find details in %s\n"47 % (exc_info[1], name))48 os.write(2, msg.encode('utf-8'))49 # This exit code is replicated from avocado/core/exit_codes.py and not50 # imported because we are dealing with import failures51 sys.exit(-1)52def main():53 sys.excepthook = handle_exception54 from avocado.core.app import AvocadoApp # pylint: disable=E061155 # Override tmp in case it's not set in env56 for attr in ("TMP", "TEMP", "TMPDIR"):...
avocado
Source:avocado
...23 "your installation, and if necessary reinstall it.\n")24 # This exit code is replicated from avocado/core/exit_codes.py and not25 # imported because we are dealing with import failures26 sys.exit(-1)27def get_crash_dir():28 crash_dir_path = os.path.join(data_dir.get_data_dir(), "crashes")29 os.makedirs(crash_dir_path)30 return crash_dir_path31def handle_exception(*exc_info):32 # Print traceback if AVOCADO_LOG_DEBUG environment variable is set33 msg = "Avocado crashed:\n" + "".join(traceback.format_exception(*exc_info))34 msg += "\n"35 if os.environ.get("AVOCADO_LOG_DEBUG"):36 os.write(2, msg.encode('utf-8'))37 # Store traceback in data_dir or TMPDIR38 prefix = "avocado-traceback-"39 prefix += time.strftime("%F_%T") + "-"40 tmp, name = tempfile.mkstemp(".log", prefix, get_crash_dir())41 os.write(tmp, msg.encode('utf-8'))42 os.close(tmp)43 # Print friendly message in console-like output44 msg = ("Avocado crashed unexpectedly: %s\nYou can find details in %s\n"45 % (exc_info[1], name))46 os.write(2, msg.encode('utf-8'))47 # This exit code is replicated from avocado/core/exit_codes.py and not48 # imported because we are dealing with import failures49 sys.exit(-1)50if __name__ == '__main__':51 sys.excepthook = handle_exception52 from avocado.core.app import AvocadoApp # pylint: disable=E061153 # Override tmp in case it's not set in env54 for attr in ("TMP", "TEMP", "TMPDIR"):...
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!!