Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python3 compatible imports #1

Merged
merged 15 commits into from
Sep 21, 2018
Merged

Python3 compatible imports #1

merged 15 commits into from
Sep 21, 2018

Conversation

rudaporto
Copy link
Contributor

  • Adjust Pickler and UnPickler imports to use ZODB._compat python 2 and… 3 compatible versions.
  • Add conditional import for cStringIO also.
  • Update setup.py to use direct ZODB package and not the ZODB3 meta package.

@rudaporto rudaporto self-assigned this Oct 21, 2017
Copy link
Member

@tseaver tseaver left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar comment to zopefoundation/AccessControl#48: Python 3.4 remains supported by the Python community, why not here? Also, setup.py needs to declare supported Python 3.x versions.

@rudaporto
Copy link
Contributor Author

rudaporto commented Oct 24, 2017

Hi @tseaver, I made the changes you requested.

But I noted that there is four tests failing in this branch or in the master branch when using Plone buildout.coredev tag 5.2.

Do you have any tip to help me fix this?

$ ./bin/test -m Products.ZopeVersionControl
Running zope.testrunner.layer.UnitTests tests:
Set up zope.testrunner.layer.UnitTests in 0.000 seconds.
Running:
6/77 (7.8%)

Failure in test testDetectPersistentSubObjectChange (Products.ZopeVersionControl.tests.testVersionControl.VersionControlTests)
Traceback (most recent call last):
File "/usr/lib64/python2.7/unittest/case.py", line 367, in run
testMethod()
File "/home/ruda/Plone/python2/buildout.coredev/src/Products.ZopeVersionControl/src/Products/ZopeVersionControl/tests/testVersionControl.py", line 668, in testDetectPersistentSubObjectChange
self.failUnless(repository.isResourceChanged(folder2))
File "/usr/lib64/python2.7/unittest/case.py", line 650, in deprecated_func
return original_func(*args, **kwargs)
File "/usr/lib64/python2.7/unittest/case.py", line 460, in assertTrue
raise self.failureException(msg)
AssertionError: False is not true

25/77 (32.5%)

Failure in test testDetectPersistentSubObjectChange (Products.ZopeVersionControl.tests.testVersionControl.VersionControlTestsWithCommits)
Traceback (most recent call last):
File "/usr/lib64/python2.7/unittest/case.py", line 367, in run
testMethod()
File "/home/ruda/Plone/python2/buildout.coredev/src/Products.ZopeVersionControl/src/Products/ZopeVersionControl/tests/testVersionControl.py", line 668, in testDetectPersistentSubObjectChange
self.failUnless(repository.isResourceChanged(folder2))
File "/usr/lib64/python2.7/unittest/case.py", line 650, in deprecated_func
return original_func(*args, **kwargs)
File "/usr/lib64/python2.7/unittest/case.py", line 460, in assertTrue
raise self.failureException(msg)
AssertionError: False is not true

45/77 (58.4%)

Failure in test testDetectPersistentSubObjectChange (Products.ZopeVersionControl.tests.testVersionControl.VersionControlTests)
Traceback (most recent call last):
File "/usr/lib64/python2.7/unittest/case.py", line 367, in run
testMethod()
File "/home/ruda/Plone/python2/buildout.coredev/src/Products.ZopeVersionControl/src/Products/ZopeVersionControl/tests/testVersionControl.py", line 668, in testDetectPersistentSubObjectChange
self.failUnless(repository.isResourceChanged(folder2))
File "/usr/lib64/python2.7/unittest/case.py", line 650, in deprecated_func
return original_func(*args, **kwargs)
File "/usr/lib64/python2.7/unittest/case.py", line 460, in assertTrue
raise self.failureException(msg)
AssertionError: False is not true

64/77 (83.1%)

Failure in test testDetectPersistentSubObjectChange (Products.ZopeVersionControl.tests.testVersionControl.VersionControlTestsWithCommits)
Traceback (most recent call last):
File "/usr/lib64/python2.7/unittest/case.py", line 367, in run
testMethod()
File "/home/ruda/Plone/python2/buildout.coredev/src/Products.ZopeVersionControl/src/Products/ZopeVersionControl/tests/testVersionControl.py", line 668, in testDetectPersistentSubObjectChange
self.failUnless(repository.isResourceChanged(folder2))
File "/usr/lib64/python2.7/unittest/case.py", line 650, in deprecated_func
return original_func(*args, **kwargs)
File "/usr/lib64/python2.7/unittest/case.py", line 460, in assertTrue
raise self.failureException(msg)
AssertionError: False is not true

Ran 77 tests with 4 failures, 0 errors, 0 skipped in 1.346 seconds.
Tearing down left over layers:
Tear down zope.testrunner.layer.UnitTests in 0.000 seconds.

@tseaver
Copy link
Member

tseaver commented Oct 24, 2017

To debug locally, I recommend installing tox, and then adding the following tox.ini file (copied from Products.ZCatalog):

[tox]
envlist =
   py27,
   py34,
   py35,
   py36

[testenv]
commands =
    {envbindir}/buildout -c {toxinidir}/buildout.cfg buildout:directory={envdir} buildout:develop={toxinidir} bootstrap
    {envbindir}/buildout -c {toxinidir}/buildout.cfg buildout:directory={envdir} buildout:develop={toxinidir}
    {envbindir}/test -v1
skip_install = true
deps =
    setuptools==33.1.1
    zc.buildout

You can then run the environment to be debugged, e.g.:

$ tox -e py27

Once that environment is created, you can debug more closely, e.g.:

$ .tox/py27/bin/test -D
Running zope.testrunner.layer.UnitTests tests:
  Set up zope.testrunner.layer.UnitTests in 0.000 seconds.


Error in test testDetectPersistentSubObjectChange (Products.ZopeVersionControl.tests.testVersionControl.VersionControlTests)
Traceback (most recent call last):
  File "/opt/Python-2.7.14/lib/python2.7/unittest/case.py", line 398, in debug
    getattr(self, self._testMethodName)()
  File "/home/tseaver/projects/Zope/Z2/Products.ZopeVersionControl/src/Products/ZopeVersionControl/tests/testVersionControl.py", line 668, in testDetectPersistentSubObjectChange
    self.failUnless(repository.isResourceChanged(folder2))
  File "/opt/Python-2.7.14/lib/python2.7/unittest/case.py", line 612, in deprecated_func
    return original_func(*args, **kwargs)
  File "/opt/Python-2.7.14/lib/python2.7/unittest/case.py", line 422, in assertTrue
    raise self.failureException(msg)
AssertionError: False is not true

AssertionError: False is not true

> /opt/Python-2.7.14/lib/python2.7/unittest/case.py(422)assertTrue()
-> raise self.failureException(msg)
(Pdb) u
> /opt/Python-2.7.14/lib/python2.7/unittest/case.py(612)deprecated_func()
-> return original_func(*args, **kwargs)
(Pdb) u
> /home/tseaver/projects/Zope/Z2/Products.ZopeVersionControl/src/Products/ZopeVersionControl/tests/testVersionControl.py(668)testDetectPersistentSubObjectChange()
-> self.failUnless(repository.isResourceChanged(folder2))
(Pdb) pp repository.__dict__
{'_branches': <BTrees.OIBTree.OIBTree object at 0x7fd0c77d7a70>,
 '_created': 1508864217.585644,
 '_histories': <BTrees.OOBTree.OOBTree object at 0x7fd0c77d75f0>,
 '_labels': <BTrees.OIBTree.OIBTree object at 0x7fd0c77d7950>,
 'id': 'repository',
 'title': ''}
(pdb)

@icemac
Copy link
Member

icemac commented Sep 13, 2018

@pbauer pbauer merged commit af5510d into master Sep 21, 2018
@icemac icemac deleted the py3_imports branch September 24, 2018 06:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants