def test_progressbar(self): """progressbar shouldhave a known output""" realstdout = sys.stdout output = StringIO.StringIO() sys.stdout = output self.assertEqual(Utils.progressbar(0, 1, 100), None) result = output.getvalue() output.close() self.assertEqual(result, "\rDownload Progress ...0%") sys.stdout = realstdout
# break # this loop makes all the runMe objects for all the files in the processqueue run_num = 0 n_good = 0 n_bad = 0 print( '{0} Building commands for {1} items in the queue'.format( DFP(), pq.dbu.Processqueue.len())) # make the cpommand lines for all the files in tehj processqueue totalsize = pq.dbu.Processqueue.len() tmp_ind = 0 Utils.progressbar(tmp_ind, 1, totalsize, text='Command Build Progress:') while pq.dbu.Processqueue.len() > 0: # do smarter pop that sorts at the db level #f = (pq.dbu.session.query(pq.dbu.Processqueue.file_id) # .join((pq.dbu.File, pq.dbu.Processqueue.file_id==pq.dbu.File.file_id)) # .order_by(pq.dbu.File.data_level, pq.dbu.File.utc_file_date).first()) #if hasattr(f, '__iter__') and len(f) == 1: # f = f[0] #pq.dbu.Processqueue.remove(f) # remove by file_id f = pq.dbu.Processqueue.pop() DBlogging.dblogger.debug( "popped {0} from pq.dbu.Processqueue.get(), {1} left". format(f, pq.dbu.Processqueue.len())) # f = pq.dbu.Processqueue.pop() # this is empty queue safe, gives None #if f is None: