Skip to content

Commit

Permalink
PY2-PY3: Use bprint to cope with byte-strings in Python 3.
Browse files Browse the repository at this point in the history
  • Loading branch information
sallner committed Sep 30, 2016
1 parent 24dc6a5 commit d5082c7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ def read(*rnames):
]

tests_require = [
'grok',
'zope.app.appsetup',
'zope.app.publication',
'zope.app.wsgi',
Expand Down
14 changes: 7 additions & 7 deletions src/grokcore/view/ftests/directoryresource/dirresource.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
>>> browser.open(
... 'http://localhost/@@/'
... 'grokcore.view.ftests.directoryresource.fixture.resource/file.txt')
>>> print(browser.contents)
>>> bprint(browser.contents)
Foo resource file's content.
Directoryresource registrations can be differentiated based on layers (and
Expand All @@ -18,7 +18,7 @@
>>> browser.open(
... 'http://localhost/++skin++another/@@/'
... 'grokcore.view.ftests.directoryresource.fixture.resource/file.txt')
>>> print(browser.contents)
>>> bprint(browser.contents)
Anotherfoo resource file's content.
This resource is only available on the particular layer::
Expand All @@ -27,7 +27,7 @@
... 'http://localhost/++skin++another/@@/'
... 'grokcore.view.ftests.directoryresource.fixture.resource/'
... 'anotherfile.txt')
>>> print(browser.contents)
>>> bprint(browser.contents)
Anotherfoo resource anotherfile's content.
>>> browser.handleErrors = True
Expand All @@ -43,25 +43,25 @@
>>> browser.handleErrors = False
>>> browser.open('http://localhost/@@/fropple/file.txt')
>>> print(browser.contents)
>>> bprint(browser.contents)
Bar resource file's content.
Subdirectories are published as directoryresources recusively::
>>> browser.open('http://localhost/@@/fropple/baz/file.txt')
>>> print(browser.contents)
>>> bprint(browser.contents)
Baz resource file's content.
A relative path to a directory with resources::
>>> browser.open('http://localhost/@@/frepple/file.txt')
>>> print(browser.contents)
>>> bprint(browser.contents)
Baz resource file's content.
An absolute path to a directory with resources::
>>> browser.open('http://localhost/@@/frupple/file.txt')
>>> print(browser.contents)
>>> bprint(browser.contents)
Baz resource file's content.
"""
2 changes: 2 additions & 0 deletions src/grokcore/view/ftests/test_functional.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import doctest
import grok.testing
import os.path
import re
import unittest
Expand Down Expand Up @@ -31,6 +32,7 @@ def suiteFromPackage(name):
globs = dict(http=zope.app.wsgi.testlayer.http,
getRootFolder=getRootFolder,
wsgi_app=layer.make_wsgi_app,
bprint=grok.testing.bprint,
)
optionflags = (
renormalizing.IGNORE_EXCEPTION_MODULE_IN_PYTHON2 +
Expand Down

0 comments on commit d5082c7

Please sign in to comment.