You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chemistry.apache.org by lm...@apache.org on 2018/07/29 16:57:38 UTC

svn commit: r1836996 [3/3] - in /chemistry/cmislib/branches/py3_compat: ./ src/cmislib/ src/cmislib/atompub/ src/cmislib/browser/ src/tests/

Modified: chemistry/cmislib/branches/py3_compat/src/cmislib/util.py
URL: http://svn.apache.org/viewvc/chemistry/cmislib/branches/py3_compat/src/cmislib/util.py?rev=1836996&r1=1836995&r2=1836996&view=diff
==============================================================================
--- chemistry/cmislib/branches/py3_compat/src/cmislib/util.py (original)
+++ chemistry/cmislib/branches/py3_compat/src/cmislib/util.py Sun Jul 29 16:57:38 2018
@@ -20,11 +20,13 @@
 """
 This module contains handy utility functions.
 """
-import sys
+import datetime
+import logging
 import re
+import sys
+
 import iso8601
-import logging
-import datetime
+
 from cmislib.domain import CmisId
 
 if sys.version_info >= (3,):
@@ -52,7 +54,7 @@ if sys.version_info >= (3,):
 else:
     from urllib import urlencode, quote
 
-    text_type = unicode
+    text_type = unicode  # noqa F821
 
     def to_native(source, encoding='utf-8', falsy_empty=False):
         if not source and falsy_empty:
@@ -70,13 +72,12 @@ else:
         return d.iteritems()
 
     def is_unicode(value):
-        return isinstance(value, unicode)
+        return isinstance(value, unicode)  # noqa F821
 
 moduleLogger = logging.getLogger('cmislib.util')
 
 
 def to_utf8(value):
-
     """ Safe encodng of value to utf-8 taking care of unicode values
     """
     if is_unicode(value):
@@ -85,7 +86,6 @@ def to_utf8(value):
 
 
 def safe_urlencode(in_dict):
-
     """
     Safe encoding of values taking care of unicode values
     urllib.urlencode doesn't like unicode values
@@ -101,7 +101,6 @@ def safe_urlencode(in_dict):
 
 
 def safe_quote(value):
-
     """
     Safe encoding of value taking care of unicode value
     urllib.quote doesn't like unicode values
@@ -111,7 +110,6 @@ def safe_quote(value):
 
 
 def multiple_replace(aDict, text):
-
     """
     Replace in 'text' all occurences of any key in the given
     dictionary by its corresponding value.  Returns the new string.
@@ -127,7 +125,6 @@ def multiple_replace(aDict, text):
 
 
 def parsePropValue(value, nodeName):
-
     """
     Returns a properly-typed object based on the type as specified in the
     node's element name.
@@ -155,7 +152,6 @@ def parsePropValue(value, nodeName):
 
 
 def parsePropValueByType(value, typeName):
-
     """
     Returns a properly-typed object based on the type as specified in the
     node's property definition.
@@ -202,7 +198,6 @@ def parsePropValueByType(value, typeName
 
 
 def parseDateTimeValue(value):
-
     """
     Utility function to return a datetime from a string.
     """
@@ -211,12 +206,12 @@ def parseDateTimeValue(value):
     elif type(value) == int:
         return datetime.datetime.fromtimestamp(value / 1000)
     else:
-        moduleLogger.debug('Could not parse dt value of type: %s' % type(value))
+        moduleLogger.debug(
+            'Could not parse dt value of type: %s' % type(value))
         return
 
 
 def parseBoolValue(value):
-
     """
     Utility function to parse booleans and none from strings
     """
@@ -232,7 +227,6 @@ def parseBoolValue(value):
 
 
 def toCMISValue(value):
-
     """
     Utility function to convert Python values to CMIS string values
     """

Modified: chemistry/cmislib/branches/py3_compat/src/tests/conftest.py
URL: http://svn.apache.org/viewvc/chemistry/cmislib/branches/py3_compat/src/tests/conftest.py?rev=1836996&r1=1836995&r2=1836996&view=diff
==============================================================================
--- chemistry/cmislib/branches/py3_compat/src/tests/conftest.py (original)
+++ chemistry/cmislib/branches/py3_compat/src/tests/conftest.py Sun Jul 29 16:57:38 2018
@@ -94,7 +94,7 @@ def cmis_conf(request):
     request.cls.max_full_text_tries = MAX_FULL_TEXT_TRIES
     for field in param._fields:
         setattr(request.cls, field, getattr(param, field))
-    request.cls.fixture_id =  '{name}-{binding}'.format(
+    request.cls.fixture_id = '{name}-{binding}'.format(
         name=param.env_name,
         binding=param.binding.__class__.__name__
     )

Modified: chemistry/cmislib/branches/py3_compat/src/tests/test_acl.py
URL: http://svn.apache.org/viewvc/chemistry/cmislib/branches/py3_compat/src/tests/test_acl.py?rev=1836996&r1=1836995&r2=1836996&view=diff
==============================================================================
--- chemistry/cmislib/branches/py3_compat/src/tests/test_acl.py (original)
+++ chemistry/cmislib/branches/py3_compat/src/tests/test_acl.py Sun Jul 29 16:57:38 2018
@@ -32,23 +32,21 @@ class TestACL:
     def testSupportedPermissions(self):
         """Test the value of supported permissions enum"""
         if not self._repo.getCapabilities()['ACL']:
-            print(messages.NO_ACL_SUPPORT)
-            return
-        assert self._repo.getSupportedPermissions() in ['basic', 'repository', 'both']
+            pytest.skip(messages.NO_ACL_SUPPORT)
+        assert self._repo.getSupportedPermissions() in [
+            'basic', 'repository', 'both']
 
     def testPermissionDefinitions(self):
         """Test the list of permission definitions"""
         if not self._repo.getCapabilities()['ACL']:
-            print(messages.NO_ACL_SUPPORT)
-            return
+            pytest.skip(messages.NO_ACL_SUPPORT)
         supportedPerms = self._repo.getPermissionDefinitions()
         assert 'cmis:write' in supportedPerms
 
     def testPermissionMap(self):
         """Test the permission mapping"""
         if not self._repo.getCapabilities()['ACL']:
-            print(messages.NO_ACL_SUPPORT)
-            return
+            pytest.skip(messages.NO_ACL_SUPPORT)
         permMap = self._repo.getPermissionMap()
         assert 'canGetProperties.Object' in permMap
         assert len(permMap['canGetProperties.Object']) > 0
@@ -56,15 +54,14 @@ class TestACL:
     def testPropagation(self):
         """Test the propagation setting"""
         if not self._repo.getCapabilities()['ACL']:
-            print(messages.NO_ACL_SUPPORT)
-            return
-        assert self._repo.getPropagation() in ['objectonly', 'propagate', 'repositorydetermined']
+            pytest.skip(messages.NO_ACL_SUPPORT)
+        assert self._repo.getPropagation() in [
+            'objectonly', 'propagate', 'repositorydetermined']
 
     def testGetObjectACL(self):
         """Test getting an object's ACL"""
         if not self._repo.getCapabilities()['ACL']:
-            print(messages.NO_ACL_SUPPORT)
-            return
+            pytest.skip(messages.NO_ACL_SUPPORT)
         acl = self._testFolder.getACL()
         for entry in acl.getEntries().values():
             assert entry.principalId
@@ -73,14 +70,12 @@ class TestACL:
     def testApplyACL(self):
         """Test updating an object's ACL"""
         if not self._repo.getCapabilities()['ACL']:
-            print(messages.NO_ACL_SUPPORT)
-            return
+            pytest.skip(messages.NO_ACL_SUPPORT)
         if not self._repo.getCapabilities()['ACL'] == 'manage':
-            print('Repository does not support manage ACL')
-            return
+            pytest.skip('Repository does not support manage ACL')
         if not self._repo.getSupportedPermissions() in ['both', 'basic']:
-            print('Repository needs to support either both or basic permissions for this test')
-            return
+            pytest.skip('Repository needs to support either both or basic '
+                        'permissions for this test')
         acl = self._testFolder.getACL()
         acl.removeEntry(self.acl_principal_id)
         acl.addEntry(self.acl_principal_id, 'cmis:write')

Modified: chemistry/cmislib/branches/py3_compat/src/tests/test_browser.py
URL: http://svn.apache.org/viewvc/chemistry/cmislib/branches/py3_compat/src/tests/test_browser.py?rev=1836996&r1=1836995&r2=1836996&view=diff
==============================================================================
--- chemistry/cmislib/branches/py3_compat/src/tests/test_browser.py (original)
+++ chemistry/cmislib/branches/py3_compat/src/tests/test_browser.py Sun Jul 29 16:57:38 2018
@@ -32,7 +32,7 @@ class TestBrowserACL(unittest.TestCase):
 
     def setUp(self):
         self.aceUser1 = BrowserACE(
-            principalId='user1',permissions='cmis:read', direct=True)
+            principalId='user1', permissions='cmis:read', direct=True)
         self.aceUser2 = BrowserACE(
             principalId='user2', permissions=['cmis:read', 'cmis:write'],
             direct=False)
@@ -83,7 +83,7 @@ class TestBrowserACL(unittest.TestCase):
             BrowserACE('user3', ['cmis:all', 'cmis:write'], True)
         # add a new entry for an exising principal
         self.acl.addEntry(
-            self.aceUser1.principalId, ['cmis:read','cmis:write'])
+            self.aceUser1.principalId, ['cmis:read', 'cmis:write'])
         addedAces = self.acl.getAddedAces()
         assert len(addedAces) == 2
         toCheck = None

Modified: chemistry/cmislib/branches/py3_compat/src/tests/test_changeentry.py
URL: http://svn.apache.org/viewvc/chemistry/cmislib/branches/py3_compat/src/tests/test_changeentry.py?rev=1836996&r1=1836995&r2=1836996&view=diff
==============================================================================
--- chemistry/cmislib/branches/py3_compat/src/tests/test_changeentry.py (original)
+++ chemistry/cmislib/branches/py3_compat/src/tests/test_changeentry.py Sun Jul 29 16:57:38 2018
@@ -34,9 +34,8 @@ class TestChangeEntry:
 
         # need to check changes capability
         changeCap = self._repo.capabilities['Changes']
-        if changeCap == None or changeCap == 'none':
-            print(messages.NO_CHANGE_LOG_SUPPORT)
-            return
+        if changeCap is None or changeCap == 'none':
+            pytest.skip(messages.NO_CHANGE_LOG_SUPPORT)
 
         # at least one change should have been made due to the creation of the
         # test documents
@@ -44,7 +43,8 @@ class TestChangeEntry:
         assert len(rs) > 0
         changeEntry = rs[0]
         assert changeEntry.objectId
-        assert changeEntry.changeType in ['created', 'updated', 'deleted', 'security']
+        assert changeEntry.changeType in [
+            'created', 'updated', 'deleted', 'security']
         assert changeEntry.changeTime
 
     def testGetACL(self):
@@ -53,18 +53,15 @@ class TestChangeEntry:
 
         # need to check changes capability
         changeCap = self._repo.capabilities['Changes']
-        if changeCap == None or changeCap == 'none':
-            print(messages.NO_CHANGE_LOG_SUPPORT)
-            return
+        if changeCap is None or changeCap == 'none':
+            pytest.skip(messages.NO_CHANGE_LOG_SUPPORT)
 
         if changeCap == 'objectidsonly':
-            print(messages.NO_CHANGE_OBJECT_SUPPORT)
-            return
+            pytest.skip(messages.NO_CHANGE_OBJECT_SUPPORT)
 
         # need to check ACL capability
         if not self._repo.capabilities['ACL']:
-            print(messages.NO_ACL_SUPPORT)
-            return
+            pytest.skip(messages.NO_ACL_SUPPORT)
 
         # need to test once with includeACL set to true
         rs = self._repo.getContentChanges(includeACL='true')
@@ -92,21 +89,21 @@ class TestChangeEntry:
 
         # need to check changes capability
         changeCap = self._repo.capabilities['Changes']
-        if changeCap == None or changeCap == 'none':
-            print(messages.NO_CHANGE_LOG_SUPPORT)
-            return
+        if changeCap is None or changeCap == 'none':
+            pytest.skip(messages.NO_CHANGE_LOG_SUPPORT)
 
         if changeCap == 'objectidsonly':
-            print(messages.NO_CHANGE_OBJECT_SUPPORT)
-            return
+            pytest.skip(messages.NO_CHANGE_OBJECT_SUPPORT)
 
-        # need to test once without includeProperties set. the objectID should be there
+        # need to test once without includeProperties set. the objectID
+        # should be there
         rs = self._repo.getContentChanges()
         assert len(rs) > 0
         changeEntry = rs[0]
         assert changeEntry.properties['cmis:objectId']
 
-        # need to test once with includeProperties set. the objectID should be there plus object props
+        # need to test once with includeProperties set. the objectID
+        # should be there plus object props
         if changeCap in ['properties', 'all']:
             rs = self._repo.getContentChanges(includeProperties='true')
             assert len(rs) > 0

Modified: chemistry/cmislib/branches/py3_compat/src/tests/test_document.py
URL: http://svn.apache.org/viewvc/chemistry/cmislib/branches/py3_compat/src/tests/test_document.py?rev=1836996&r1=1836995&r2=1836996&view=diff
==============================================================================
--- chemistry/cmislib/branches/py3_compat/src/tests/test_document.py (original)
+++ chemistry/cmislib/branches/py3_compat/src/tests/test_document.py Sun Jul 29 16:57:38 2018
@@ -30,6 +30,7 @@ from .tools import skipIfAlfrescoPubBind
 from .tools import skipIfAlfrescoBrowserBinding
 from cmislib import util
 
+
 @pytest.mark.usefixtures('cmis_env', 'binary_files')
 class TestDocument:
 
@@ -40,7 +41,7 @@ class TestDocument:
         props = {'cmis:objectTypeId': self.versionable_type_id}
         newDoc = self._testFolder.createDocument(
             'testDocument', properties=props)
-        if not 'canCheckOut' in newDoc.allowableActions.keys():
+        if 'canCheckOut' not in newDoc.allowableActions.keys():
             pytest.skip('The test doc cannot be checked out...skipping')
         pwcDoc = newDoc.checkout()
         try:
@@ -50,13 +51,13 @@ class TestDocument:
         finally:
             pwcDoc.delete()
 
-    #CMIS-743
+    # CMIS-743
     def testCheckoutAfterFetchByID(self):
         """Create a test doc, fetch it by ID, then check it out"""
         props = {'cmis:objectTypeId': self.versionable_type_id}
         newDoc = self._testFolder.createDocument(
             'testDocument', properties=props)
-        if not 'canCheckOut' in newDoc.allowableActions.keys():
+        if 'canCheckOut' not in newDoc.allowableActions.keys():
             pytest.skip('The test doc cannot be checked out...skipping')
         newDocIdStr = str(newDoc.id)
         newDoc = self._repo.getObject(newDocIdStr)
@@ -77,7 +78,7 @@ class TestDocument:
             testDoc = self._testFolder.createDocument(
                 testFilename, contentFile=f, properties=props)
         assert testFilename == testDoc.getName()
-        if not 'canCheckOut' in testDoc.allowableActions.keys():
+        if 'canCheckOut' not in testDoc.allowableActions.keys():
             pytest.skip('The test doc cannot be checked out...skipping')
         pwcDoc = testDoc.checkout()
 
@@ -99,15 +100,15 @@ class TestDocument:
             testDoc = self._testFolder.createDocument(
                 testFilename, contentFile=f, properties=props)
         assert testFilename == testDoc.getName()
-        if not 'canCheckOut' in testDoc.allowableActions.keys():
+        if 'canCheckOut' not in testDoc.allowableActions.keys():
             pytest.skip('The test doc cannot be checked out...skipping')
         pwcDoc = testDoc.checkout()
         try:
             assert testDoc.isCheckedOut()
             testDoc = pwcDoc.checkin(checkinComment='Just a few changes')
             assert not testDoc.isCheckedOut()
-            assert 'Just a few changes' == \
-                          testDoc.getProperties()['cmis:checkinComment']
+            assert ('Just a few changes' ==
+                    testDoc.getProperties()['cmis:checkinComment'])
         finally:
             if testDoc.isCheckedOut():
                 pwcDoc.delete()
@@ -121,7 +122,7 @@ class TestDocument:
             testDoc = self._testFolder.createDocument(
                 testFilename, contentFile=f, properties=props)
         assert testFilename == testDoc.getName()
-        if not 'canCheckOut' in testDoc.allowableActions.keys():
+        if 'canCheckOut' not in testDoc.allowableActions.keys():
             pytest.skip('The test doc cannot be checked out...skipping')
         pwcDoc = testDoc.checkout()
         try:
@@ -157,7 +158,7 @@ class TestDocument:
         """Create a document in a test folder, check it out, call getPWC,
         then checkin
         """
-        if not self._repo.getCapabilities()['PWCUpdatable'] == True:
+        if not self._repo.getCapabilities()['PWCUpdatable']:
             pytest.skip('Repository does not support PWCUpdatable, skipping')
         testFilename = self.binary_filename_1
         props = {'cmis:objectTypeId': self.versionable_type_id}
@@ -167,7 +168,7 @@ class TestDocument:
         assert testFilename == testDoc.getName()
         # Alfresco has a bug where if you get the PWC this way
         # the checkin will not be successful
-        if not 'canCheckOut' in testDoc.allowableActions.keys():
+        if 'canCheckOut' not in testDoc.allowableActions.keys():
             pytest.skip('The test doc cannot be checked out...skipping')
         testDoc.checkout()
         pwcDoc = testDoc.getPrivateWorkingCopy()
@@ -187,7 +188,7 @@ class TestDocument:
         props = {'cmis:objectTypeId': self.versionable_type_id}
         newDoc = self._testFolder.createDocument(
             'testDocument', properties=props)
-        if not 'canCheckOut' in newDoc.allowableActions.keys():
+        if 'canCheckOut' not in newDoc.allowableActions.keys():
             pytest.skip('The test doc cannot be checked out...skipping')
         pwcDoc = newDoc.checkout()
         try:
@@ -214,16 +215,16 @@ class TestDocument:
         with open(self.binary_file_1, 'rb') as f:
             doc10 = self._testFolder.createDocument(
                 fileName, contentFile=f, properties=props)
-        if not 'canCheckOut' in doc10.allowableActions.keys():
+        if 'canCheckOut' not in doc10.allowableActions.keys():
             pytest.skip('The test doc cannot be checked out...skipping')
         pwc = doc10.checkout()
         doc11 = pwc.checkin(major='false')  # checkin a minor version, 1.1
-        if not 'canCheckOut' in doc11.allowableActions.keys():
+        if 'canCheckOut' not in doc11.allowableActions.keys():
             pytest.skip('The test doc cannot be checked out...skipping')
         pwc = doc11.checkout()
         doc20 = pwc.checkin()  # checkin a major version, 2.0
         doc20Id = doc20.getObjectId()
-        if not 'canCheckOut' in doc20.allowableActions.keys():
+        if 'canCheckOut' not in doc20.allowableActions.keys():
             pytest.skip('The test doc cannot be checked out...skipping')
         pwc = doc20.checkout()
         doc21 = pwc.checkin(major='false')  # checkin a minor version, 2.1
@@ -242,18 +243,18 @@ class TestDocument:
         with open(self.binary_file_1, 'rb') as f:
             doc10 = self._testFolder.createDocument(
                 fileName, contentFile=f, properties=props)
-        if not 'canCheckOut' in doc10.allowableActions.keys():
+        if 'canCheckOut' not in doc10.allowableActions.keys():
             pytest.skip('The test doc cannot be checked out...skipping')
         pwc = doc10.checkout()
         doc11 = pwc.checkin(major='false')  # checkin a minor version, 1.1
-        if not 'canCheckOut' in doc11.allowableActions.keys():
+        if 'canCheckOut' not in doc11.allowableActions.keys():
             pytest.skip('The test doc cannot be checked out...skipping')
         pwc = doc11.checkout()
         doc20 = pwc.checkin()  # checkin a major version, 2.0
         # what comes back from a checkin may not include all props, so reload
         doc20.reload()
         doc20Label = doc20.getProperties()['cmis:versionLabel']
-        if not 'canCheckOut' in doc20.allowableActions.keys():
+        if 'canCheckOut' not in doc20.allowableActions.keys():
             pytest.skip('The test doc cannot be checked out...skipping')
         pwc = doc20.checkout()
         doc21 = pwc.checkin(major='false')  # checkin a minor version, 2.1
@@ -318,7 +319,7 @@ class TestDocument:
         assert testFile1Size == os.path.getsize(exportFile1)
 
         # checkout the file
-        if newDoc.allowableActions.get('canCheckOut') == True:
+        if newDoc.allowableActions.get('canCheckOut'):
             pass
         else:
             pytest.skip('The test doc cannot be checked out...skipping')
@@ -344,8 +345,8 @@ class TestDocument:
     def testSetContentStreamPWCMimeType(self):
         """Check the mimetype after the PWC checkin"""
         if self._repo.getCapabilities()['ContentStreamUpdatability'] == 'none':
-            print('This repository does not allow content stream updates, skipping')
-            return
+            pytest.skip('This repository does not allow content stream '
+                        'updates, skipping')
 
         testFile1 = self.binary_file_1
         fileName = testFile1.split('/')[-1]
@@ -358,7 +359,7 @@ class TestDocument:
         origMimeType = newDoc.properties['cmis:contentStreamMimeType']
 
         # checkout the file
-        if not 'canCheckOut' in newDoc.allowableActions.keys():
+        if 'canCheckOut' not in newDoc.allowableActions.keys():
             pytest.skip('The test doc cannot be checked out...skipping')
         pwc = newDoc.checkout()
 
@@ -371,14 +372,15 @@ class TestDocument:
 
         # CMIS-231 the checked in doc should have the same mime type as
         # the original document
-        assert origMimeType == \
-                          newDoc.properties['cmis:contentStreamMimeType']
+        assert (origMimeType ==
+                newDoc.properties['cmis:contentStreamMimeType'])
 
     @skipIfAlfrescoPubBinding
     @skipIfAlfrescoBrowserBinding
     def testSetContentStreamDoc(self):
         """Set the content stream on a doc that's not checked out"""
-        if self._repo.getCapabilities()['ContentStreamUpdatability'] != 'anytime':
+        if self._repo.getCapabilities()[
+                'ContentStreamUpdatability'] != 'anytime':
             pytest.skip('This repository does not allow content stream '
                         'updates on the doc, skipping')
 
@@ -424,7 +426,7 @@ class TestDocument:
             pytest.skip(
                 'This repository does not allow content stream updates, '
                 'skipping')
-        if not self._repo.getCapabilities()['PWCUpdatable'] == True:
+        if not self._repo.getCapabilities()['PWCUpdatable']:
             pytest.skip('Repository does not support PWCUpdatable, skipping')
 
         # create a test document
@@ -433,9 +435,8 @@ class TestDocument:
         with open(self.binary_file_1, 'rb') as f:
             newDoc = self._testFolder.createDocument(
                 fileName, contentFile=f, properties=props)
-        if not 'canCheckOut' in newDoc.allowableActions.keys():
-            print('The test doc cannot be checked out...skipping')
-            return
+        if 'canCheckOut' not in newDoc.allowableActions.keys():
+            pytest.skip('The test doc cannot be checked out...skipping')
         pwc = newDoc.checkout()
         pwc.deleteContentStream()
         with pytest.raises(CmisException):
@@ -457,8 +458,8 @@ class TestDocument:
         exportFilename = testFilename.replace('.', 'export.')
         with closing(result), open(exportFilename, 'wb') as outfile:
             outfile.write(result.read())
-        assert os.path.getsize(testFile) == \
-                          os.path.getsize(exportFilename)
+        assert (os.path.getsize(testFile) ==
+                os.path.getsize(exportFilename))
 
         # cleanup
         os.remove(exportFilename)
@@ -467,10 +468,13 @@ class TestDocument:
         """Create a new document from a string"""
         documentName = 'testDocument'
         contentString = 'Test content string'
-        newDoc = self._testFolder.createDocumentFromString(documentName,
-            contentString=contentString, contentType='text/plain')
+        newDoc = self._testFolder.createDocumentFromString(
+            documentName,
+            contentString=contentString,
+            contentType='text/plain')
         assert documentName == newDoc.getName()
-        assert util.to_native(newDoc.getContentStream().read()) == contentString
+        assert util.to_native(
+            newDoc.getContentStream().read()) == contentString
 
     def testCreateDocumentPlain(self):
         """Create a plain document using a file from the file system"""
@@ -491,8 +495,8 @@ class TestDocument:
         exportFilename = testFilename.replace('txt', 'export.txt')
         with closing(result), open(exportFilename, 'wb') as outfile:
             outfile.write(result.read())
-        assert os.path.getsize(testFilename) == \
-                          os.path.getsize(exportFilename)
+        assert (os.path.getsize(testFilename) ==
+                os.path.getsize(exportFilename))
 
         # export
         os.remove(exportFilename)
@@ -502,27 +506,20 @@ class TestDocument:
         """Get all versions of an object"""
         props = {'cmis:objectTypeId': self.versionable_type_id}
         testDoc = self._testFolder.createDocument('testdoc', properties=props)
-        if not 'canCheckOut' in testDoc.allowableActions.keys():
+        if 'canCheckOut' not in testDoc.allowableActions.keys():
             pytest.skip('The test doc cannot be checked out...skipping')
         pwc = testDoc.checkout()
         doc = pwc.checkin()  # 2.0
-        if not 'canCheckOut' in doc.allowableActions.keys():
+        if 'canCheckOut' not in doc.allowableActions.keys():
             pytest.skip('The test doc cannot be checked out...skipping')
         pwc = doc.checkout()
         doc = pwc.checkin()  # 3.0
         # what comes back from a checkin may not include all props, so reload
         doc.reload()
         # InMemory 0.9 is using 'V 3.0' so this test fails with that server
-        #self.assertEquals('3.0', doc.getProperties()['cmis:versionLabel'])
+        # self.assertEquals('3.0', doc.getProperties()['cmis:versionLabel'])
         rs = doc.getAllVersions()
         assert 3 == len(rs.getResults())
-#        for count in range(0, 3):
-#            if count == 0:
-#                self.assertEquals('true',
-#                             rs.getResults().values()[count].getProperties()['cmis:isLatestVersion'])
-#            else:
-#                self.assertEquals('false',
-#                             rs.getResults().values()[count].getProperties()['cmis:isLatestVersion'])
 
     def testGetObjectParents(self):
         """Gets all object parents of an CmisObject"""
@@ -548,7 +545,9 @@ class TestDocument:
         assert len(subFolder2.getChildren()) == 0
         subFolder2.addObject(doc)
         assert len(subFolder2.getChildren()) == 1
-        assert subFolder1.getChildren()[0].name == subFolder2.getChildren()[0].name
+        assert (
+            subFolder1.getChildren()[0].name ==
+            subFolder2.getChildren()[0].name)
         parentNames = ['sub1', 'sub2']
         for parent in doc.getObjectParents():
             parentNames.remove(parent.name)
@@ -589,7 +588,7 @@ class TestDocument:
         testDoc = self._testFolder.createDocumentFromString(
             'testdoc.txt', contentString='test', contentType='text/plain')
         sleep(10)
-        if testDoc.getAllowableActions().get('canGetRenditions') == True:
+        if testDoc.getAllowableActions().get('canGetRenditions'):
             rends = testDoc.getRenditions()
             assert len(rends) >= 1
         else:

Modified: chemistry/cmislib/branches/py3_compat/src/tests/test_folder.py
URL: http://svn.apache.org/viewvc/chemistry/cmislib/branches/py3_compat/src/tests/test_folder.py?rev=1836996&r1=1836995&r2=1836996&view=diff
==============================================================================
--- chemistry/cmislib/branches/py3_compat/src/tests/test_folder.py (original)
+++ chemistry/cmislib/branches/py3_compat/src/tests/test_folder.py Sun Jul 29 16:57:38 2018
@@ -70,7 +70,8 @@ class TestFolder:
         assert isInResultSet(resultSet, grandChild)
 
         # test getting descendants with depth=-1
-        resultSet = self._testFolder.getDescendants()  # -1 is the default depth
+        # -1 is the default depth
+        resultSet = self._testFolder.getDescendants()
         assert resultSet is not None
         assert 3 == len(resultSet.getResults())
         assert isInResultSet(resultSet, childFolder1)
@@ -159,16 +160,18 @@ class TestFolder:
         # should be filtered if the server chooses to do so.
 
         # test when used with getObjectByPath
-        searchFolder = self._repo.getObjectByPath(subFolderPath,
-                        filter='cmis:objectId,cmis:objectTypeId,cmis:baseTypeId')
+        searchFolder = self._repo.getObjectByPath(
+            subFolderPath,
+            filter='cmis:objectId,cmis:objectTypeId,cmis:baseTypeId')
         assert subFolder.getObjectId() == searchFolder.getObjectId()
         assert 'cmis:objectId' in searchFolder.getProperties()
         assert 'cmis:objectTypeId' in searchFolder.getProperties()
         assert 'cmis:baseTypeId' in searchFolder.getProperties()
 
         # test when used with getObjectByPath + reload
-        searchFolder = self._repo.getObjectByPath(subFolderPath,
-                        filter='cmis:objectId,cmis:objectTypeId,cmis:baseTypeId')
+        searchFolder = self._repo.getObjectByPath(
+            subFolderPath,
+            filter='cmis:objectId,cmis:objectTypeId,cmis:baseTypeId')
         searchFolder.reload()
         assert subFolder.getObjectId() == searchFolder.getObjectId()
         assert 'cmis:objectId' in searchFolder.getProperties()
@@ -176,16 +179,18 @@ class TestFolder:
         assert 'cmis:baseTypeId' in searchFolder.getProperties()
 
         # test when used with getObject
-        searchFolder = self._repo.getObject(subFolder.getObjectId(),
-                        filter='cmis:objectId,cmis:objectTypeId,cmis:baseTypeId')
+        searchFolder = self._repo.getObject(
+            subFolder.getObjectId(),
+            filter='cmis:objectId,cmis:objectTypeId,cmis:baseTypeId')
         assert subFolder.getObjectId() == searchFolder.getObjectId()
         assert 'cmis:objectId' in searchFolder.getProperties()
         assert 'cmis:objectTypeId' in searchFolder.getProperties()
         assert 'cmis:baseTypeId' in searchFolder.getProperties()
 
         # test when used with getObject + reload
-        searchFolder = self._repo.getObject(subFolder.getObjectId(),
-                        filter='cmis:objectId,cmis:objectTypeId,cmis:baseTypeId')
+        searchFolder = self._repo.getObject(
+            subFolder.getObjectId(),
+            filter='cmis:objectId,cmis:objectTypeId,cmis:baseTypeId')
         searchFolder.reload()
         assert subFolder.getObjectId() == searchFolder.getObjectId()
         assert 'cmis:objectId' in searchFolder.getProperties()
@@ -231,8 +236,7 @@ class TestFolder:
     def testAddObject(self):
         """Add an existing object to another folder"""
         if not self._repo.getCapabilities()['Multifiling']:
-            print('This repository does not allow multifiling, skipping')
-            return
+            pytest.skip('This repository does not allow multifiling, skipping')
 
         subFolder1 = self._testFolder.createFolder('sub1')
         doc = subFolder1.createDocument('testdoc1')
@@ -241,13 +245,14 @@ class TestFolder:
         assert len(subFolder2.getChildren()) == 0
         subFolder2.addObject(doc)
         assert len(subFolder2.getChildren()) == 1
-        assert subFolder1.getChildren()[0].name == subFolder2.getChildren()[0].name
+        assert (
+            subFolder1.getChildren()[0].name ==
+            subFolder2.getChildren()[0].name)
 
     def testRemoveObject(self):
         """Remove an existing object from a secondary folder"""
         if not self._repo.getCapabilities()['Unfiling']:
-            print('This repository does not allow unfiling, skipping')
-            return
+            pytest.skip('This repository does not allow unfiling, skipping')
 
         subFolder1 = self._testFolder.createFolder('sub1')
         doc = subFolder1.createDocument('testdoc1')
@@ -256,7 +261,9 @@ class TestFolder:
         assert len(subFolder2.getChildren()) == 0
         subFolder2.addObject(doc)
         assert len(subFolder2.getChildren()) == 1
-        assert subFolder1.getChildren()[0].name == subFolder2.getChildren()[0].name
+        assert (
+            subFolder1.getChildren()[0].name ==
+            subFolder2.getChildren()[0].name)
         subFolder2.removeObject(doc)
         assert len(subFolder2.getChildren()) == 0
         assert len(subFolder1.getChildren()) == 1
@@ -278,7 +285,8 @@ class TestFolder:
     def testBadParentFolder(self):
         """Try to create a folder on a bad/bogus/deleted parent
         folder object"""
-        firstFolder = self._testFolder.createFolder('testBadParentFolder folder')
+        firstFolder = self._testFolder.createFolder(
+            'testBadParentFolder folder')
         assert 'cmis:objectId' in firstFolder.getProperties()
         firstFolder.delete()
         # folder isn't in the repo anymore, but I still have the object

Modified: chemistry/cmislib/branches/py3_compat/src/tests/test_query.py
URL: http://svn.apache.org/viewvc/chemistry/cmislib/branches/py3_compat/src/tests/test_query.py?rev=1836996&r1=1836995&r2=1836996&view=diff
==============================================================================
--- chemistry/cmislib/branches/py3_compat/src/tests/test_query.py (original)
+++ chemistry/cmislib/branches/py3_compat/src/tests/test_query.py Sun Jul 29 16:57:38 2018
@@ -46,7 +46,7 @@ class TestQuery:
         with open(self.binary_file_2, 'rb') as f:
             self._testContent2 = self._testFolder.createDocument(
                 testFileName.replace('.', '2.'), contentFile=f)
-        
+
     def testSimpleSelect(self):
         """Execute simple select star from cmis:document"""
         querySimpleSelect = "SELECT * FROM cmis:document"
@@ -56,14 +56,16 @@ class TestQuery:
     def testWildcardPropertyMatch(self):
         """Find content w/wildcard match on cmis:name property"""
         name = self._testContent.getProperties()['cmis:name']
-        querySimpleSelect = "SELECT * FROM cmis:document where cmis:name like '" + name[:7] + "%'"
+        querySimpleSelect = "SELECT * FROM cmis:document where " \
+                            "cmis:name like '" + name[:7] + "%'"
         resultSet = self._repo.query(querySimpleSelect)
         assert isInResultSet(resultSet, self._testContent)
 
     def testPropertyMatch(self):
         """Find content matching cmis:name property"""
         name = self._testContent2.getProperties()['cmis:name']
-        querySimpleSelect = "SELECT * FROM cmis:document where cmis:name = '" + name + "'"
+        querySimpleSelect = "SELECT * FROM cmis:document where " \
+                            "cmis:name = '" + name + "'"
         resultSet = self._repo.query(querySimpleSelect)
         assert isInResultSet(resultSet, self._testContent2)
 
@@ -71,8 +73,9 @@ class TestQuery:
         """Find content matching cmis:name property"""
         name = self._testContent2.getProperties()['cmis:name']
         new_name = u'éà€ô' + name
-        self._testContent2.updateProperties({'cmis:name': name})
-        querySimpleSelect = "SELECT * FROM cmis:document where cmis:name = '" + name + "'"
+        self._testContent2.updateProperties({'cmis:name': new_name})
+        querySimpleSelect = "SELECT * FROM cmis:document where " \
+                            "cmis:name = '" + new_name + "'"
         resultSet = self._repo.query(querySimpleSelect)
         assert isInResultSet(resultSet, self._testContent2)
 
@@ -90,8 +93,9 @@ class TestQuery:
             found = isInResultSet(resultSet, self._testContent2)
             if not found:
                 maxTries -= 1
-                print('Not found...sleeping for 10 secs. Remaining tries:%d'
-                      % maxTries)
+                print(
+                    'Not found...sleeping for 10 secs. Remaining tries:%d'
+                    % maxTries)
                 sleep(10)
         assert found
 
@@ -112,6 +116,7 @@ class TestQuery:
             found = isInResultSet(resultSet, self._testContent2)
             if not found:
                 maxTries -= 1
-                prin('Not found...sleeping for 10 secs. Remaining tries:%d' % maxTries)
+                print('Not found...sleeping for 10 secs. Remaining tries:%d'
+                      % maxTries)
                 sleep(10)
         assert found

Modified: chemistry/cmislib/branches/py3_compat/src/tests/test_repository.py
URL: http://svn.apache.org/viewvc/chemistry/cmislib/branches/py3_compat/src/tests/test_repository.py?rev=1836996&r1=1836995&r2=1836996&view=diff
==============================================================================
--- chemistry/cmislib/branches/py3_compat/src/tests/test_repository.py (original)
+++ chemistry/cmislib/branches/py3_compat/src/tests/test_repository.py Sun Jul 29 16:57:38 2018
@@ -75,17 +75,19 @@ class TestRepository:
     def testCreateDocument(self):
         """Create a new 'content-less' document"""
         documentName = 'testDocument'
-        newDoc = self._repo.createDocument(documentName, parentFolder=self._testFolder)
+        newDoc = self._repo.createDocument(
+            documentName, parentFolder=self._testFolder)
         assert documentName == newDoc.getName()
 
     def testCreateDocumentFromString(self):
         """Create a new document from a string"""
         documentName = 'testDocument'
         contentString = 'Test content string'
-        newDoc = self._repo.createDocumentFromString(documentName,
-                                           parentFolder=self._testFolder,
-                                           contentString=contentString,
-                                           contentType='text/plain')
+        newDoc = self._repo.createDocumentFromString(
+            documentName,
+            parentFolder=self._testFolder,
+            contentString=contentString,
+            contentType='text/plain')
         assert documentName == newDoc.getName()
         assert util.to_native(
             newDoc.getContentStream().read()) == contentString
@@ -94,7 +96,8 @@ class TestRepository:
     def testCreateDocumentUnicode(self):
         """Create a new doc with unicode characters in the name"""
         documentName = u'abc cdeöäüß%§-_caféè.txt'
-        newDoc = self._repo.createDocument(documentName, parentFolder=self._testFolder)
+        newDoc = self._repo.createDocument(
+            documentName, parentFolder=self._testFolder)
         assert documentName == newDoc.getName()
 
     def testGetObject(self):
@@ -115,20 +118,17 @@ class TestRepository:
             doc10 = self._testFolder.createDocument(
                 fileName, contentFile=f, properties=props)
         doc10Id = doc10.getObjectId()
-        if not 'canCheckOut' in doc10.allowableActions.keys():
-            print('The test doc cannot be checked out...skipping')
-            return
+        if 'canCheckOut' not in doc10.allowableActions.keys():
+            pytest.skip('The test doc cannot be checked out...skipping')
         pwc = doc10.checkout()
         doc11 = pwc.checkin(major='false')  # checkin a minor version, 1.1
-        if not 'canCheckOut' in doc11.allowableActions.keys():
-            print('The test doc cannot be checked out...skipping')
-            return
+        if 'canCheckOut' not in doc11.allowableActions.keys():
+            pytest.skip('The test doc cannot be checked out...skipping')
         pwc = doc11.checkout()
         doc20 = pwc.checkin()  # checkin a major version, 2.0
         doc20Id = doc20.getObjectId()
-        if not 'canCheckOut' in doc20.allowableActions.keys():
-            print('The test doc cannot be checked out...skipping')
-            return
+        if 'canCheckOut' not in doc20.allowableActions.keys():
+            pytest.skip('The test doc cannot be checked out...skipping')
         pwc = doc20.checkout()
         doc21 = pwc.checkin(major='false')  # checkin a minor version, 2.1
         doc21Id = doc21.getObjectId()
@@ -136,7 +136,8 @@ class TestRepository:
         docLatest = self._repo.getObject(doc10Id, returnVersion='latest')
         assert doc21Id == docLatest.getObjectId()
 
-        docLatestMajor = self._repo.getObject(doc10Id, returnVersion='latestmajor')
+        docLatestMajor = self._repo.getObject(
+            doc10Id, returnVersion='latestmajor')
         assert doc20Id == docLatestMajor.getObjectId()
 
     def testGetFolder(self):
@@ -171,8 +172,9 @@ class TestRepository:
             # ask the doc for its paths
             searchDocPaths = doc.getPaths()
             # for each path in the list, try to get the object by path
-            # this is better than building a path with the doc's name b/c the name
-            # isn't guaranteed to be used as the path segment (see CMIS-232)
+            # this is better than building a path with the doc's name b/c
+            # the name isn't guaranteed to be used as the path segment
+            # (see CMIS-232)
             for path in searchDocPaths:
                 searchDoc = self._repo.getObjectByPath(path)
                 assert doc.getObjectId() == searchDoc.getObjectId()
@@ -203,12 +205,12 @@ class TestRepository:
         assert len(subFolder2.getChildren()) == 1
         assert doc.name == subFolder2.getChildren()[0].name
 
-    #Exceptions
+    # Exceptions
 
     def testGetObjectBadId(self):
         """Attempt to get an object using a known bad ID"""
-        # this object ID is implementation specific (Alfresco) but is universally
-        # bad so it should work for all repositories
+        # this object ID is implementation specific (Alfresco) but is
+        # universally bad so it should work for all repositories
         with pytest.raises(ObjectNotFoundException):
             self._repo.getObject(self._testFolder.getObjectId()[:-5] + 'BADID')
 

Modified: chemistry/cmislib/branches/py3_compat/src/tests/test_type.py
URL: http://svn.apache.org/viewvc/chemistry/cmislib/branches/py3_compat/src/tests/test_type.py?rev=1836996&r1=1836995&r2=1836996&view=diff
==============================================================================
--- chemistry/cmislib/branches/py3_compat/src/tests/test_type.py (original)
+++ chemistry/cmislib/branches/py3_compat/src/tests/test_type.py Sun Jul 29 16:57:38 2018
@@ -50,8 +50,8 @@ class TestType:
         """Get the child types for this repository and make sure cmis:folder
         is in the list."""
 
-        #This test would be more interesting if there was a standard way to
-        #deploy a custom model. Then we could look for custom types.
+        # This test would be more interesting if there was a standard way to
+        # deploy a custom model. Then we could look for custom types.
 
         cmisClient = CmisClient(self.url, self.user, self.pwd,
                                 binding=self.binding,

Modified: chemistry/cmislib/branches/py3_compat/src/tests/tools.py
URL: http://svn.apache.org/viewvc/chemistry/cmislib/branches/py3_compat/src/tests/tools.py?rev=1836996&r1=1836995&r2=1836996&view=diff
==============================================================================
--- chemistry/cmislib/branches/py3_compat/src/tests/tools.py (original)
+++ chemistry/cmislib/branches/py3_compat/src/tests/tools.py Sun Jul 29 16:57:38 2018
@@ -69,5 +69,6 @@ def skipIf(fixtureIds):
 def skipIfAlfrescoBrowserBinding(func):
     return skipIf(['alfresco-BrowserBinding'])(func)
 
+
 def skipIfAlfrescoPubBinding(func):
-    return skipIf(['alfresco-AtomPubBinding'])(func)
\ No newline at end of file
+    return skipIf(['alfresco-AtomPubBinding'])(func)

Modified: chemistry/cmislib/branches/py3_compat/tox.ini
URL: http://svn.apache.org/viewvc/chemistry/cmislib/branches/py3_compat/tox.ini?rev=1836996&r1=1836995&r2=1836996&view=diff
==============================================================================
--- chemistry/cmislib/branches/py3_compat/tox.ini (original)
+++ chemistry/cmislib/branches/py3_compat/tox.ini Sun Jul 29 16:57:38 2018
@@ -6,18 +6,15 @@
 [tox]
 envlist = 
   py27
-  py34
-  py35
+  #py34
+  #py35
   py36
 
 [testenv]
 usedevelop = True
 # todo --flake8
-commands = py.test --cov-config=.coveragerc --cov-branch --cov=src/cmislib {posargs}
+commands = py.test --flake8 --cov-config=.coveragerc --cov-branch --cov=src/cmislib {posargs}
 deps =
     pytest
     pytest-cov
     pytest-flake8
-
-[pytest]
-flake8-max-line-length = 120