Skip to content

Commit

Permalink
Move bprint to grok.testing.
Browse files Browse the repository at this point in the history
It is now used in different places, at least in `grokcore.view`.
  • Loading branch information
sallner committed Sep 30, 2016
1 parent 3da9c08 commit 8815fa6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
12 changes: 1 addition & 11 deletions src/grok/ftests/test_grok_functional.py
Expand Up @@ -38,16 +38,6 @@ def http_call(method, path, data=None, **kw):
return zope.app.wsgi.testlayer.http(request_string, handle_errors=False)


def bprint(data):
"""Python 2 and 3 doctest compatible print.
http://python3porting.com/problems.html#string-representation
"""
if not isinstance(data, str):
data = data.decode()
print(data.strip())


def suiteFromPackage(name):
files = resource_listdir(__name__, name)
suite = unittest.TestSuite()
Expand All @@ -64,7 +54,7 @@ def suiteFromPackage(name):
getRootFolder=layer.getRootFolder,
http=zope.app.wsgi.testlayer.http,
http_call=http_call,
bprint=bprint,
bprint=grok.testing.bprint,
wsgi_app=layer.make_wsgi_app,
),
optionflags=(
Expand Down
10 changes: 10 additions & 0 deletions src/grok/testing.py
Expand Up @@ -78,3 +78,13 @@ def warn(message, category=None, stacklevel=1):
message,
line.strip(),
))


def bprint(data):
"""Python 2 and 3 doctest compatible print.
http://python3porting.com/problems.html#string-representation
"""
if not isinstance(data, str):
data = data.decode()
print(data.strip())

0 comments on commit 8815fa6

Please sign in to comment.