summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGael Pasgrimaud <gael@gawel.org>2011-10-19 12:26:42 +0200
committerGael Pasgrimaud <gael@gawel.org>2011-10-19 12:26:42 +0200
commit4971bc0e4588ef101af59f666ba13a6e35a01012 (patch)
tree82f284fccd975dd2f84232d00326599b4f54fe38
parentb4389bd2a8cf9521ac62f6b0a8cf210bec1b7cbb (diff)
downloadwebtest-1.3.2.tar.gz
improve print_stderr. conf.py now read version from setup.py1.3.2
-rw-r--r--docs/conf.py16
-rw-r--r--docs/news.txt8
-rwxr-xr-xsetup.py2
-rw-r--r--tests/test_testing.py8
-rw-r--r--webtest/compat.py8
5 files changed, 36 insertions, 6 deletions
diff --git a/docs/conf.py b/docs/conf.py
index 22783ea..efbdc68 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -40,7 +40,7 @@ copyright = '2008, Ian Bicking'
# other places throughout the built documents.
#
# The full version, including alpha/beta/rc tags.
-version = release = '1.3.1'
+version = release = '1.3.2'
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
@@ -128,3 +128,17 @@ htmlhelp_basename = 'WebTestdoc'
# If false, no module index is generated.
#latex_use_modindex = True
+
+from os import path
+pkg_dir = path.abspath(__file__).split('/docs')[0]
+setup = path.join(pkg_dir, 'setup.py')
+if path.isfile(setup):
+ for line_ in open(setup):
+ if line_.startswith("version"):
+ version = line_.split('=')[-1]
+ version = version.strip()
+ version = version.strip("'\"")
+ release = version
+ break
+del pkg_dir, setup, path
+
diff --git a/docs/news.txt b/docs/news.txt
index 211b300..b7885ba 100644
--- a/docs/news.txt
+++ b/docs/news.txt
@@ -1,10 +1,12 @@
News
====
-1.3.2 (Unreleased)
--------------------
+1.3.2
+-----
+
+* improve showbrowser. fixed `#23 <https://bitbucket.org/ianb/webtest/issue/23>`_
-* improve showbrowser. fixed `#23 <https://bitbucket.org/ianb/webtest/issue/23`_
+* print_stderr fail with unicode string on python2
1.3.1
-----
diff --git a/setup.py b/setup.py
index 66f2740..269faac 100755
--- a/setup.py
+++ b/setup.py
@@ -4,7 +4,7 @@ from setuptools import find_packages
import sys
import os
-version = '1.3.1'
+version = '1.3.2'
setup(name='WebTest',
version=version,
diff --git a/tests/test_testing.py b/tests/test_testing.py
index 1f07636..164adb5 100644
--- a/tests/test_testing.py
+++ b/tests/test_testing.py
@@ -1,7 +1,15 @@
+# -*- coding: utf-8 -*-
import webtest
from webtest.debugapp import debug_app
from webtest.compat import to_bytes
+from webtest.compat import print_stderr
from tests.compat import unittest
+from tests.compat import u
+
+
+def test_print_unicode():
+ print_stderr(u('°C'))
+
class TestTesting(unittest.TestCase):
diff --git a/webtest/compat.py b/webtest/compat.py
index 83d5f89..c1da383 100644
--- a/webtest/compat.py
+++ b/webtest/compat.py
@@ -69,4 +69,10 @@ def print_stderr(value):
if PY3:
exec('print(value, file=sys.stderr)')
else:
- exec('print >> sys.stderr, value')
+ if isinstance(value, text_type):
+ # not really clean but this must *never* fail
+ try:
+ value = value.encode('utf-8')
+ except:
+ value = repr(value)
+ sys.stderr.write(value)