Best Python code snippet using pandera_python
time_get_bibs.py
Source:time_get_bibs.py
...24# end = datetime.now()25# diff = end - begin26# print('Returned {} normal bibs'.format(len(bibs)))27# return diff28def test_coroutines(mms_ids):29 # creates a datetime object showing long it took for mm_ids30 # to be retrieved async via coroutines31 begin = datetime.now()32 input_params = [{"ids": {'mms_id': mms_id}, "data": None} for mms_id in mms_ids]33 bibs = api.cor_get_bibs(input_params)34 end = datetime.now()35 diff = end - begin36 count = 037 for bib in bibs:38 if bib[1] > 200:39 count += 140 print('\n\nReturned {} coroutine bibs, with {} errors'.format((len(bibs)-count),count))41 return [diff, bibs]42def list_from_csv(csvfile, number):43 with open(csvfile, 'rt', encoding='utf8') as handle:44 reader = csv.reader(handle)45 ids = []46 counter = number47 for row in reader:48 if counter > 0:49 ids.append(row[0])50 counter -= 151 return ids52def test_repeat_bibs():53 num = int(input("Enter number of items to test: "))54 ids = create_id_list(num)55 t_coroutine = test_coroutines(ids)56 print("\n\nTime elapsed for {} ids: \n Coroutines: {} \n ".format(num, t_coroutine[0]))57def write_to_csv(coroutines):58 with open('bibs_output.csv', 'w') as csvfile:59 bibwriter = csv.writer(csvfile)60 # bibwriter.writerow(['mms_id', 'status', 'msg'])61 bib_list = coroutines62 bibwriter.writerow(["ids", "status", "msg"])63 for bib in bib_list:64 bibwriter.writerow(bib)65def test_from_csv(handle, num):66 ids = list_from_csv(handle, num)67 t_coroutine = test_coroutines(ids)68 print("\n\nTime elapsed for {} ids: \n Coroutines: {} \n ".format(num, t_coroutine[0]))69 return t_coroutine[1]70if __name__ == '__main__':71 num = int(input("Enter number of items to test: "))72 handle = 'bibs.csv'73 bib_list = test_from_csv(handle, num)...
conftest.py
Source:conftest.py
1"""Configuration for test environment"""2import sys3from .fixtures import *4collect_ignore = []5if sys.version_info < (3, 5):6 collect_ignore.append("test_async.py")7if sys.version_info < (3, 4):...
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!!