[pywin32-checkins] pywin32/com/win32comext/bits/test test_bits.py, 1.1.2.4, 1.1.2.5
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: Mark H. <mha...@us...> - 2008-02-07 09:06:13
|
Update of /cvsroot/pywin32/pywin32/com/win32comext/bits/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4566 Modified Files: Tag: sidnei-bits test_bits.py Log Message: fixes/tweaks to the tests. Index: test_bits.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32comext/bits/test/Attic/test_bits.py,v retrieving revision 1.1.2.4 retrieving revision 1.1.2.5 diff -C2 -d -r1.1.2.4 -r1.1.2.5 *** test_bits.py 7 Feb 2008 08:43:44 -0000 1.1.2.4 --- test_bits.py 7 Feb 2008 09:06:15 -0000 1.1.2.5 *************** *** 7,11 **** job_name = 'bits-pywin32-test' ! states = dict([(val, (name.split('_')[-1])) for name, val in vars(bits).items() if name.startswith('BG_JOB_STATE_')]) --- 7,11 ---- job_name = 'bits-pywin32-test' ! states = dict([(val, (name[13:])) for name, val in vars(bits).items() if name.startswith('BG_JOB_STATE_')]) *************** *** 31,35 **** print 'To', f.GetLocalName() print 'The following error happened:' ! print error.GetErrorDescription(0) if f.GetRemoteName().endswith('missing-favicon.ico'): print 'Changing to point to correct file' --- 31,35 ---- print 'To', f.GetLocalName() print 'The following error happened:' ! self._print_error(error) if f.GetRemoteName().endswith('missing-favicon.ico'): print 'Changing to point to correct file' *************** *** 40,45 **** job.Cancel() def JobModification(self, job, reserved): ! print 'Job Modification', job, states.get(job.GetState()) job = bcm.CreateJob(job_name, bits.BG_JOB_TYPE_DOWNLOAD) --- 40,59 ---- job.Cancel() + def _print_error(self, err): + ctx, hresult = err.GetError() + try: + hresult_msg = win32api.FormatMessage(hresult) + except win32api.error: + hresult_msg = "" + print "Context=0x%x, hresult=0x%x (%s)" % (ctx, hresult, hresult_msg) + print err.GetErrorDescription() + def JobModification(self, job, reserved): ! state = job.GetState() ! print 'Job Modification', job.GetDisplayName(), states.get(state) ! if state in (bits.BG_JOB_STATE_ERROR, bits.BG_JOB_STATE_TRANSIENT_ERROR): ! print "Error details:" ! err = job.GetError() ! self._print_error(err) job = bcm.CreateJob(job_name, bits.BG_JOB_TYPE_DOWNLOAD) |