Changeset 2702
- Timestamp:
- 02/17/06 21:58:51 (19 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/tests/filldb.py
r2683 r2702 9 9 import time 10 10 11 def showTiming(number, before) : 12 """Displays timing information.""" 13 elapsed = time.time() - before 14 persecond = int(float(number) / elapsed) 15 sys.stdout.write("\nTime elapsed : %.2f seconds (%i entries per second)\n\n" % (elapsed, persecond)) 16 11 17 def createBillingCodes(number) : 12 18 """Creates a number of billing codes.""" … … 20 26 before = time.time() 21 27 os.system('pkbcodes --arguments arguments.list') 22 after = time.time() 23 sys.stdout.write("\nTime elapsed : %.2f seconds\n\n" % (after - before)) 28 showTiming(number, before) 24 29 25 def deleteBillingCodes( ) :30 def deleteBillingCodes(number) : 26 31 """Deletes all test billing codes.""" 27 32 sys.stdout.write("Deleting billing codes...\n") 28 33 before = time.time() 29 34 os.system('pkbcodes --delete "test-billingcode-*"') 30 after = time.time() 31 sys.stdout.write("\nTime elapsed : %.2f seconds\n\n" % (after - before)) 35 showTiming(number, before) 32 36 33 37 def createPrinters(number) : … … 42 46 before = time.time() 43 47 os.system('pkprinters --arguments arguments.list') 44 after = time.time() 45 sys.stdout.write("\nTime elapsed : %.2f seconds\n\n" % (after - before)) 48 showTiming(number, before) 46 49 47 def deletePrinters( ) :50 def deletePrinters(number) : 48 51 """Deletes all test printers.""" 49 52 sys.stdout.write("Deleting printers...\n") 50 53 before = time.time() 51 54 os.system('pkprinters --delete "test-printer-*"') 52 after = time.time() 53 sys.stdout.write("\nTime elapsed : %.2f seconds\n\n" % (after - before)) 55 showTiming(number, before) 54 56 55 57 def createUsers(number) : … … 64 66 before = time.time() 65 67 os.system('edpykota --arguments arguments.list') 66 after = time.time() 67 sys.stdout.write("\nTime elapsed : %.2f seconds\n\n" % (after - before)) 68 showTiming(number, before) 68 69 69 def deleteUsers( ) :70 def deleteUsers(number) : 70 71 """Deletes all test users.""" 71 72 sys.stdout.write("Deleting users...\n") 72 73 before = time.time() 73 74 os.system('edpykota --delete "test-user-*"') 74 after = time.time() 75 sys.stdout.write("\nTime elapsed : %.2f seconds\n\n" % (after - before)) 75 showTiming(number, before) 76 76 77 77 if __name__ == "__main__" : … … 89 89 createUsers(nbusers) 90 90 if nbbillingcodes : 91 deleteBillingCodes( )91 deleteBillingCodes(nbbillingcodes) 92 92 if nbusers : 93 deleteUsers( ) # NB : either this one or the one below93 deleteUsers(nbusers) # NB : either this one or the one below 94 94 if nbprinters : 95 deletePrinters( ) # also delete user print quota entries.95 deletePrinters(nbprinters) # also delete user print quota entries. 96 96 os.remove("arguments.list") 97 97