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/11/27 19:11:36 UTC
svn commit: r1847588 - in /chemistry/cmislib/branches/py3_compat/src/tests:
conftest.py test_repository.py
Author: lmignon
Date: Tue Nov 27 19:11:36 2018
New Revision: 1847588
URL: http://svn.apache.org/viewvc?rev=1847588&view=rev
Log:
[PATCH] skip test with '+' into folder name for alfresco < 6.0.0
Modified:
chemistry/cmislib/branches/py3_compat/src/tests/conftest.py
chemistry/cmislib/branches/py3_compat/src/tests/test_repository.py
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=1847588&r1=1847587&r2=1847588&view=diff
==============================================================================
--- chemistry/cmislib/branches/py3_compat/src/tests/conftest.py (original)
+++ chemistry/cmislib/branches/py3_compat/src/tests/conftest.py Tue Nov 27 19:11:36 2018
@@ -19,6 +19,7 @@
#
import os
+import re
import tempfile
from collections import namedtuple
from time import time
@@ -98,6 +99,69 @@ def _generate_conf(request):
)
+class _Version(object):
+ component_re = re.compile(r'(\d+ | [a-z]+ | \.)', re.VERBOSE)
+
+ def __init__(self, vstring):
+ self._version = self.parse(vstring)
+
+ def parse(self, vstring):
+ components = [x for x in self.component_re.split(vstring)
+ if x and x != '.']
+ for i, obj in enumerate(components):
+ try:
+ components[i] = int(obj)
+ except ValueError:
+ pass
+ return components
+
+ def _cmp(self, other):
+ if isinstance(other, str):
+ other = _Version(other)
+ if self._version == other._version:
+ return 0
+ if self._version < other._version:
+ return -1
+ if self._version > other._version:
+ return 1
+
+ def __cmp__(self, other):
+ return self._cmp(other)
+
+ def __repr__(self):
+ return "%s ('%s')" % (self.__class__.__name__, str(self._version))
+
+ def __eq__(self, other):
+ c = self._cmp(other)
+ if c is NotImplemented:
+ return c
+ return c == 0
+
+ def __lt__(self, other):
+ c = self._cmp(other)
+ if c is NotImplemented:
+ return c
+ return c < 0
+
+ def __le__(self, other):
+ c = self._cmp(other)
+ if c is NotImplemented:
+ return c
+ return c <= 0
+
+ def __gt__(self, other):
+ c = self._cmp(other)
+ if c is NotImplemented:
+ return c
+ return c > 0
+
+ def __ge__(self, other):
+ c = self._cmp(other)
+ if c is NotImplemented:
+ return c
+ return c >= 0
+
+
@pytest.fixture(params=CMIS_ENV_PARAMS, ids=CMIS_ENV_IDS)
def cmis_conf(request):
"""Apply config params as attribute on the class"""
@@ -125,6 +189,9 @@ def cmis_env(request):
'cmislib', request.cls.__name__, str(time())])
request.cls._testFolder = request.cls._rootFolder.createFolder(
request.cls._folderName)
+ productVersion = request.cls._repo.getRepositoryInfo().get(
+ 'productVersion', '9.9.9')
+ request.cls._productVersion = _Version(productVersion)
yield request
try:
request.cls._testFolder.deleteTree()
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=1847588&r1=1847587&r2=1847588&view=diff
==============================================================================
--- chemistry/cmislib/branches/py3_compat/src/tests/test_repository.py (original)
+++ chemistry/cmislib/branches/py3_compat/src/tests/test_repository.py Tue Nov 27 19:11:36 2018
@@ -155,6 +155,9 @@ class TestRepository:
them by path"""
# names of folders and test docs (without and with unicode char)
for suffix in ['', u'_éà â¬$', ' +']:
+ if '+' in suffix and self._productVersion < '6.0.0':
+ print('+ not supported in alfresco < 6.0.0')
+ continue
parentFolderName = 'testGetObjectByPath folder' + suffix
subFolderName = 'subfolder' + suffix
docName = 'testdoc' + suffix