[Checkins] SVN: zope.fssync/trunk/s clean up unused imports and variables, fix undefined name in getSynchronizer and add a test

Patrick Strawderman patrick at zope.com
Fri Oct 15 18:05:51 EDT 2010


Log message for revision 117584:
  clean up unused imports and variables, fix undefined name in getSynchronizer and add a test

Changed:
  U   zope.fssync/trunk/setup.py
  U   zope.fssync/trunk/src/zope/fssync/fsmerger.py
  U   zope.fssync/trunk/src/zope/fssync/metadata.py
  U   zope.fssync/trunk/src/zope/fssync/repository.py
  U   zope.fssync/trunk/src/zope/fssync/svn.py
  U   zope.fssync/trunk/src/zope/fssync/synchronizer.py
  U   zope.fssync/trunk/src/zope/fssync/task.py
  U   zope.fssync/trunk/src/zope/fssync/tests/test_fsmerger.py
  A   zope.fssync/trunk/src/zope/fssync/tests/test_synchronizer.py
  U   zope.fssync/trunk/src/zope/fssync/tests/test_task.py

-=-
Modified: zope.fssync/trunk/setup.py
===================================================================
--- zope.fssync/trunk/setup.py	2010-10-15 21:52:35 UTC (rev 117583)
+++ zope.fssync/trunk/setup.py	2010-10-15 22:05:51 UTC (rev 117584)
@@ -49,7 +49,7 @@
       packages=find_packages('src'),
       package_dir = {'': 'src'},
       namespace_packages=['zope',],
-      tests_require = ['zope.testing', 'py'],
+      tests_require = ['ZODB3', 'zope.testing', 'py'],
       extras_require={
           'test': ['zope.testing',
                    'py'],

Modified: zope.fssync/trunk/src/zope/fssync/fsmerger.py
===================================================================
--- zope.fssync/trunk/src/zope/fssync/fsmerger.py	2010-10-15 21:52:35 UTC (rev 117583)
+++ zope.fssync/trunk/src/zope/fssync/fsmerger.py	2010-10-15 22:05:51 UTC (rev 117584)
@@ -19,8 +19,7 @@
 import os
 import shutil
 
-from os.path import basename, dirname, exists, isfile, isdir, join
-from os.path import realpath, normcase, normpath
+from os.path import basename, dirname, exists, isfile, isdir, join, normcase
 
 from zope.xmlpickle import dumps
 

Modified: zope.fssync/trunk/src/zope/fssync/metadata.py
===================================================================
--- zope.fssync/trunk/src/zope/fssync/metadata.py	2010-10-15 21:52:35 UTC (rev 117583)
+++ zope.fssync/trunk/src/zope/fssync/metadata.py	2010-10-15 22:05:51 UTC (rev 117584)
@@ -28,7 +28,7 @@
 
 from cStringIO import StringIO
 from os.path import exists, isfile, split, join, realpath, normcase
-from xml.sax import ContentHandler, parse, parseString
+from xml.sax import ContentHandler, parseString
 from xml.sax.saxutils import quoteattr
 
 import fsutil

Modified: zope.fssync/trunk/src/zope/fssync/repository.py
===================================================================
--- zope.fssync/trunk/src/zope/fssync/repository.py	2010-10-15 21:52:35 UTC (rev 117583)
+++ zope.fssync/trunk/src/zope/fssync/repository.py	2010-10-15 22:05:51 UTC (rev 117584)
@@ -15,7 +15,7 @@
 
 $Id: repository.py 73003 2007-03-06 10:34:19Z oestermeier $
 """
-import os, copy
+import copy
 import os
 import sys
 import unicodedata
@@ -24,8 +24,8 @@
 
 import metadata
 import interfaces
+from fsutil import Error
 
-
 unwanted = ("", os.curdir, os.pardir)
 
 class Repository(object):
@@ -66,7 +66,6 @@
         Adds a number to the file and leaves the case untouched.
         """
         if self.case_insensitive or self.enforce_nfd:
-            count = 1
             if self.enforce_nfd:
                 dirpath = self._toNFD(dirpath)
                 name = self._toNFD(name)
@@ -149,7 +148,7 @@
         if encoding is None:
             encoding = fsencoding
         if isinstance(path, unicode):
-            return normalize(path).encode(encoding)
+            return self.normalize(path).encode(encoding)
         return unicode(path, encoding=fsencoding).encode(encoding)
 
     def writeable(self, path):

Modified: zope.fssync/trunk/src/zope/fssync/svn.py
===================================================================
--- zope.fssync/trunk/src/zope/fssync/svn.py	2010-10-15 21:52:35 UTC (rev 117583)
+++ zope.fssync/trunk/src/zope/fssync/svn.py	2010-10-15 22:05:51 UTC (rev 117584)
@@ -103,7 +103,6 @@
         there is no metadata entry for the file, return a new empty
         dict, modifications to which will also be flushed.
         """
-        fullpath = self.repository.fullpath(file)
         dir, base = self.repository.split(file)
         return self.getmanager(dir).getentry(base)
 

Modified: zope.fssync/trunk/src/zope/fssync/synchronizer.py
===================================================================
--- zope.fssync/trunk/src/zope/fssync/synchronizer.py	2010-10-15 21:52:35 UTC (rev 117583)
+++ zope.fssync/trunk/src/zope/fssync/synchronizer.py	2010-10-15 22:05:51 UTC (rev 117584)
@@ -266,7 +266,7 @@
 
     Those cases may be unexpected and it may be a problem that
     the data are not completely serialized. If raise_error is True
-    we raise a MissingSerializer in those cases.
+    we raise a MissingSynchronizer in those cases.
     """
     dn = dottedname(obj.__class__)
     factory = component.queryUtility(interfaces.ISynchronizerFactory, name=dn)
@@ -274,7 +274,7 @@
         factory = component.queryUtility(interfaces.ISynchronizerFactory)
     if factory is None:
         if raise_error:
-            raise MissingSerializer(dn)
+            raise MissingSynchronizer(dn)
         return None
     return factory(obj)
 

Modified: zope.fssync/trunk/src/zope/fssync/task.py
===================================================================
--- zope.fssync/trunk/src/zope/fssync/task.py	2010-10-15 21:52:35 UTC (rev 117583)
+++ zope.fssync/trunk/src/zope/fssync/task.py	2010-10-15 22:05:51 UTC (rev 117584)
@@ -27,9 +27,7 @@
 import metadata
 import interfaces
 import synchronizer
-import repository
 import fsutil
-import pickle
 
 from synchronizer import dottedname
 
@@ -264,7 +262,6 @@
 
     def synchSpecials(self, fspath, specials, add_callback):
         """Synchronize an extra or annotation mapping."""
-        repository = self.repository
         md = self.metadata.getmanager(fspath)
         entries = md.entries
         synchronizer = self.getSynchronizer(specials)
@@ -345,7 +342,6 @@
         if not entry:
             # This object was not included on the filesystem; skip it
             return
-        cont = self.getSynchronizer(container)
         key = originalKey(fspath, name, self.metadata)
         obj = traverseKey(container, key)
         synchronizer = self.getSynchronizer(obj)
@@ -574,7 +570,6 @@
         if not name:
             self.checkDirectory(container, fspath)
         else:
-            synchronizer = self.getSynchronizer(container)
             key = originalKey(fspath, name, self.metadata)
             try:
                 traverseKey(container, key)
@@ -662,7 +657,6 @@
             if not self.repository.exists(fspath):
                 self.conflict(fspath)
 
-        synchronizer = self.getSynchronizer(container)
         key = originalKey(fspath, name, self.metadata)
         obj = traverseKey(container, key)
         adapter = self.getSynchronizer(obj)

Modified: zope.fssync/trunk/src/zope/fssync/tests/test_fsmerger.py
===================================================================
--- zope.fssync/trunk/src/zope/fssync/tests/test_fsmerger.py	2010-10-15 21:52:35 UTC (rev 117583)
+++ zope.fssync/trunk/src/zope/fssync/tests/test_fsmerger.py	2010-10-15 22:05:51 UTC (rev 117584)
@@ -225,7 +225,7 @@
         os.mkdir(remotedir)
 
         localfile = self.addfile(localdir, name, localdata, localentry)
-        origfile = self.addorigfile(localdir, name, origdata)
+        self.addorigfile(localdir, name, origdata)
         remotefile = self.addfile(remotedir, name, remotedata, remoteentry)
 
         m.merge_dirs(localdir, remotedir)

Added: zope.fssync/trunk/src/zope/fssync/tests/test_synchronizer.py
===================================================================
--- zope.fssync/trunk/src/zope/fssync/tests/test_synchronizer.py	                        (rev 0)
+++ zope.fssync/trunk/src/zope/fssync/tests/test_synchronizer.py	2010-10-15 22:05:51 UTC (rev 117584)
@@ -0,0 +1,14 @@
+import unittest
+import zope.fssync.synchronizer
+
+class TestSynchronizer(unittest.TestCase):
+
+    def test_missing_synchronizer(self):
+        self.assertRaises(zope.fssync.synchronizer.MissingSynchronizer,
+                          zope.fssync.synchronizer.getSynchronizer,
+                          object(), True)
+
+def test_suite():
+    suite = unittest.TestSuite()
+    suite.addTest(unittest.makeSuite(TestSynchronizer))
+    return suite


Property changes on: zope.fssync/trunk/src/zope/fssync/tests/test_synchronizer.py
___________________________________________________________________
Added: svn:eol-style
   + native

Modified: zope.fssync/trunk/src/zope/fssync/tests/test_task.py
===================================================================
--- zope.fssync/trunk/src/zope/fssync/tests/test_task.py	2010-10-15 21:52:35 UTC (rev 117583)
+++ zope.fssync/trunk/src/zope/fssync/tests/test_task.py	2010-10-15 22:05:51 UTC (rev 117584)
@@ -27,7 +27,7 @@
 import zope.interface
 from zope.traversing.interfaces import TraversalError, IContainmentRoot
 from zope.traversing.interfaces import ITraversable, ITraverser
-from zope.xmlpickle import loads, dumps
+from zope.xmlpickle import dumps
 from zope.location import Location
 from zope.filerepresentation.interfaces import IFileFactory
 from zope.filerepresentation.interfaces import IDirectoryFactory
@@ -245,7 +245,6 @@
         f.close()
         container = TestContainer()
         name = "contentType"
-        root = TestRoot()
         try:
             self.create_object(container, name, {}, fspath, list().append) #, context=root)
         finally:



More information about the checkins mailing list