Update of /cvsroot/pywin32/pywin32/com/win32comext/bits/test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20933
Modified Files:
Tag: sidnei-bits
test_bits.py
Log Message:
- Add some comments to clarify the intent of this test, and a hint about the behaviour of JobError
Index: test_bits.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32comext/bits/test/Attic/test_bits.py,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.6
diff -C2 -d -r1.1.2.5 -r1.1.2.6
*** test_bits.py 7 Feb 2008 09:06:15 -0000 1.1.2.5
--- test_bits.py 8 Feb 2008 01:54:31 -0000 1.1.2.6
***************
*** 1,2 ****
--- 1,4 ----
+
+
from win32com.server.util import wrap
import pythoncom, sys, os, time, win32api, win32event, tempfile
***************
*** 35,39 ****
print 'Changing to point to correct file'
f2 = f.QueryInterface(bits.IID_IBackgroundCopyFile2)
! f2.SetRemoteName(r'http://www.python.org/favicon.ico')
job.Resume()
else:
--- 37,43 ----
print 'Changing to point to correct file'
f2 = f.QueryInterface(bits.IID_IBackgroundCopyFile2)
! favicon = 'http://www.python.org/favicon.ico'
! print 'Changing RemoteName from', f2.GetRemoteName(), 'to', favicon
! f2.SetRemoteName(favicon)
job.Resume()
else:
***************
*** 65,70 ****
bits.BG_NOTIFY_JOB_MODIFICATION)
! job.AddFile(r'http://www.python.org/favicon.ico', os.path.join(tempfile.gettempdir(), 'bits-favicon.ico'))
! job.AddFile(r'http://www.non-existing.domain/missing-favicon.ico', os.path.join(tempfile.gettempdir(), 'bits-missing-favicon.ico'))
# job.Suspend()
--- 69,86 ----
bits.BG_NOTIFY_JOB_MODIFICATION)
!
! # The idea here is to intentionally make one of the files fail to be
! # downloaded. Then the JobError notification will be triggered, where
! # we do fix the failing file by calling SetRemoteName to a valid URL
! # and call Resume() on the job, making the job finish successfully.
! #
! # Note to self: A domain that cannot be resolved will cause
! # TRANSIENT_ERROR instead of ERROR, and the JobError notification will
! # not be triggered! This can bite you during testing depending on how
! # your DNS is configured. For example, if you use OpenDNS.org's DNS
! # servers, an invalid hostname will *always* be resolved (they
! # redirect you to a search page), so be careful when testing.
! job.AddFile('http://www.python.org/favicon.ico', os.path.join(tempfile.gettempdir(), 'bits-favicon.ico'))
! job.AddFile('http://www.python.org/missing-favicon.ico', os.path.join(tempfile.gettempdir(), 'bits-missing-favicon.ico'))
# job.Suspend()
|