Skip to content

Commit

Permalink
Merge pull request #3 from zopefoundation/issue2
Browse files Browse the repository at this point in the history
Add Python 3.7 and fix tests on Python 2.
  • Loading branch information
jamadden committed Oct 22, 2018
2 parents 4aa622d + 1a0df9c commit c78e4cc
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 30 deletions.
9 changes: 8 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,14 @@ python:
- 3.4
- 3.5
- 3.6
- pypy-5.4.1
- pypy
- pypy3
matrix:
include:
- python: "3.7"
dist: xenial
sudo: true

script:
- coverage run -m zope.testrunner --test-path=src --auto-color --auto-progress

Expand Down
4 changes: 2 additions & 2 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
CHANGES
=========

4.0.1 (unreleased)
4.1.0 (unreleased)
==================

- Nothing changed yet.
- Add support for Python 3.7.


4.0.0 (2017-05-29)
Expand Down
6 changes: 4 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def read(*rnames):
return f.read()

setup(name='zope.app.session',
version='4.0.1.dev0',
version='4.1.0.dev0',
author='Zope Corporation and Contributors',
author_email='zope-dev@zope.org',
description='Zope session',
Expand All @@ -44,16 +44,18 @@ def read(*rnames):
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
'Natural Language :: English',
'Operating System :: OS Independent',
'Topic :: Internet :: WWW/HTTP',
'Framework :: Zope :: 3',
],
url='http://github.com/zopefoundation/zope.app.session',
url='https://github.com/zopefoundation/zope.app.session',
packages=find_packages('src'),
package_dir={'': 'src'},
namespace_packages=['zope', 'zope.app'],
Expand Down
9 changes: 6 additions & 3 deletions src/zope/app/session/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,15 @@ Restrictions

Data stored in the session must be persistent or picklable.

>>> session['oops'] = open(__file__)
>>> class NoPickle(object):
... def __getstate__(self):
... raise TypeError("Cannot serialize")
>>> session['oops'] = NoPickle()
>>> import transaction
>>> transaction.commit()
Traceback (most recent call last):
[...]
TypeError: cannot serialize ...
...
TypeError: Cannot serialize

..
Clean up:
Expand Down
35 changes: 14 additions & 21 deletions src/zope/app/session/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
from io import BytesIO
import unittest
import doctest
import re

import transaction

Expand All @@ -33,11 +32,24 @@
from zope.app.publication.interfaces import IBeforeTraverseEvent


# Previously from zope.app.zptpage

from zope.container.contained import Contained
from persistent import Persistent
from zope.pagetemplate.pagetemplate import PageTemplate
from zope.interface import implementer
from zope.interface import Interface
from zope.schema import SourceText
from zope.schema import TextLine

from zope.pagetemplate.engine import AppPT

from webtest import TestApp

# We continue to use the old imports to make sure that backwards
# compatibility holds.
from zope.app.session.interfaces import IClientId, IClientIdManager, ISession
from zope.app.session.interfaces import ISessionDataContainer
from zope.app.session.interfaces import ISessionPkgData, ISessionData
from zope.app.session.session import ClientId, Session
from zope.app.session.session import PersistentSessionDataContainer
from zope.app.session.session import RAMSessionDataContainer
Expand All @@ -61,17 +73,6 @@ def tearDown(test):
placelesssetup.tearDown()


# Previously from zope.app.zptpage

from zope.container.contained import Contained
from persistent import Persistent
from zope.pagetemplate.pagetemplate import PageTemplate
from zope.interface import implementer
from zope.interface import Interface
from zope.schema import SourceText
from zope.schema import TextLine

from zope.pagetemplate.engine import AppPT

class IZPTPage(Interface):
"""ZPT Pages are a persistent implementation of Page Templates."""
Expand Down Expand Up @@ -157,8 +158,6 @@ def index(self, **kw):
return template.render(request, **kw)


from webtest import TestApp

class BrowserTestCase(unittest.TestCase):

layer = SessionLayer
Expand All @@ -170,9 +169,6 @@ def setUp(self):

self._testapp = TestApp(self.layer.make_wsgi_app())

def tearDown(self):
super(BrowserTestCase, self).tearDown()

def commit(self):
transaction.commit()

Expand Down Expand Up @@ -300,9 +296,6 @@ def test_suite():
optionflags=(doctest.ELLIPSIS
| doctest.NORMALIZE_WHITESPACE
| renormalizing.IGNORE_EXCEPTION_MODULE_IN_PYTHON2),
checker=renormalizing.RENormalizing((
(re.compile("TypeError: can't pickle"), 'TypeError: cannot serialize'),
)),
),
unittest.defaultTestLoader.loadTestsFromName(__name__),
))
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py27,py34,py35,py36,pypy
envlist = py27,py34,py35,py36,py37,pypy

[testenv]
commands =
Expand Down

0 comments on commit c78e4cc

Please sign in to comment.