Skip to content

Commit

Permalink
Python 3 support. (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Howitz authored and hannosch committed Oct 8, 2016
1 parent 82e889e commit 0d48fb1
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 12 deletions.
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ language: python
sudo: false
python:
- 2.7
- 3.3
- 3.4
- 3.5
install:
- pip install tox-travis
script:
Expand Down
2 changes: 1 addition & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Changelog
1.3 (unreleased)
----------------

- Nothing changed yet.
- Python 3 compatibility.


1.2 (2016-06-07)
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@
],
extras_require=dict(
test=[
'zope.app.publisher',
'zope.browserpage',
'zope.app.wsgi',
'zope.configuration',
'zope.principalregistry',
'zope.testbrowser',
'zope.testbrowser>=5.0',
'zope.testing',
],
),
Expand Down
8 changes: 3 additions & 5 deletions src/zope/globalrequest/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ relatively, so we have to make it available from somewhere else in order to regi
... <configure
... xmlns="http://namespaces.zope.org/zope"
... xmlns:browser="http://namespaces.zope.org/browser">
... <include package="zope.app.publisher" file="meta.zcml" />
... <include package="zope.browserpage" file="meta.zcml" />
... <browser:page
... name="foo"
... for="*"
Expand All @@ -72,10 +72,8 @@ Next let's make sure our test view actually works:
The view tries to query for a utility and use it to "calculate" it's response,
so let's define one:

>>> from zope.interface import implements
>>> from zope.globalrequest import getRequest
>>> class Foo(object):
... implements(IFoo)
... def foo(self):
... request = getRequest()
... if request:
Expand Down Expand Up @@ -131,6 +129,6 @@ If we now provide a request value we should be greeted properly:

Once the request has been processed, it should not be available anymore:

>>> print getRequest()
>>> print(getRequest())
None

11 changes: 8 additions & 3 deletions src/zope/globalrequest/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import doctest
import zope.app.wsgi.testlayer
import zope.globalrequest
import zope.testbrowser.wsgi


def zcml(source):
Expand All @@ -16,16 +17,20 @@ def zcml(source):
def tearDown(test):
cleanUp()

testLayer = zope.app.wsgi.testlayer.BrowserLayer(zope.globalrequest)

class Layer(zope.testbrowser.wsgi.TestBrowserLayer,
zope.app.wsgi.testlayer.BrowserLayer):
"""Layer to prepare zope.testbrowser using the WSGI app."""

testLayer = Layer(zope.globalrequest)


def test_suite():
flags = doctest.NORMALIZE_WHITESPACE | doctest.ELLIPSIS
readme = doctest.DocFileSuite(
'README.rst',
package='zope.globalrequest',
globs={
'zcml': zcml},
globs={'zcml': zcml},
optionflags=flags,
tearDown=tearDown)
readme.layer = testLayer
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tox]
envlist =
py27
py27,py33,py34,py35

[testenv]
deps =
Expand Down

0 comments on commit 0d48fb1

Please sign in to comment.