[Zope-Checkins] CVS: Zope/lib/python/OFS/tests - testProductInit.py:1.1.2.2

Tim Peters tim.one at comcast.net
Thu Jan 15 22:07:33 EST 2004


Update of /cvs-repository/Zope/lib/python/OFS/tests
In directory cvs.zope.org:/tmp/cvs-serv6874/lib/python/OFS/tests

Modified Files:
      Tag: Zope-2_7-branch
	testProductInit.py 
Log Message:
dummy_product_init global:  this interpolated a file path into a quoted
string, but used a regular string instead of a raw string.  File paths
on Windows normally contain backslashes, so pieces of file paths got
treated like string escape sequences on Windows, leading to nonsense and
test failures.  Repaired simply by making it a raw string.


=== Zope/lib/python/OFS/tests/testProductInit.py 1.1.2.1 => 1.1.2.2 ===
--- Zope/lib/python/OFS/tests/testProductInit.py:1.1.2.1	Sun Jan 11 10:31:46 2004
+++ Zope/lib/python/OFS/tests/testProductInit.py	Thu Jan 15 22:07:32 2004
@@ -38,9 +38,12 @@
 </zodb_db>
 """
 
+
 dummy_product_init = """
 def initialize(context):
-    f=open('%s', 'w')
+    # CAUTION:  must use raw string in the open(), in case the interpolated
+    # file path contains backslashes.
+    f=open(r'%s', 'w')
     f.write('didit')
     f.close()
 misc_ = {'a':1}
@@ -124,7 +127,7 @@
         for name in FAKEPRODUCTS:
             self.assert_(name in names)
         self.assert_('gleeb' not in names)
-        
+
     def test_file_on_products_path_is_not_product(self):
         self.makeFakeProducts()
         f = open(os.path.join(TEMPPRODUCTS, 'README.txt'), 'w')




More information about the Zope-Checkins mailing list