dev-python/beaker: patch to fix failed test, fixes bug #557026
authorIan Delaney <idella4@gentoo.org>
Sun, 16 Aug 2015 05:32:33 +0000 (13:32 +0800)
committerIan Delaney <idella4@gentoo.org>
Sun, 16 Aug 2015 05:32:33 +0000 (13:32 +0800)
Package-Manager: portage-2.2.20

dev-python/beaker/beaker-1.7.0-r1.ebuild
dev-python/beaker/files/beaker-1.7.0-cookie-testfix.patch [new file with mode: 0644]

index 13b2fe6c5a2107622879809d465e5925c3dd62e1..032a14b0648708a7825cebfcede741a70c9f3343 100644 (file)
@@ -27,8 +27,13 @@ DEPEND="dev-python/setuptools[${PYTHON_USEDEP}]
        )"
 RDEPEND=""
 
+# Py2.7 fais some tests without this
+DISTUTILS_IN_SOURCE_BUILD=1
+
 S="${WORKDIR}/${P}dev"
 
+PATCHES=( "${FILESDIR}"/${P}-cookie-testfix.patch )
+
 python_prepare_all() {
        # Workaround for http://bugs.python.org/issue11276.
        sed -e "s/import anydbm/& as anydbm/;/import anydbm/a dbm = anydbm" \
diff --git a/dev-python/beaker/files/beaker-1.7.0-cookie-testfix.patch b/dev-python/beaker/files/beaker-1.7.0-cookie-testfix.patch
new file mode 100644 (file)
index 0000000..364d112
--- /dev/null
@@ -0,0 +1,40 @@
+https://github.com/bbangert/beaker/commit/714f464cac9d14e338cf4420163292acaab3bb49
+diff --git a/beaker/session.py b/beaker/session.py
+index 10a87f2..f1a585f 100644
+--- a/beaker/session.py
++++ b/beaker/session.py
+@@ -226,7 +226,7 @@ def _create_id(self, set_new=True):
+             self.last_accessed = None
+         if self.use_cookies:
+             self._set_cookie_values()
+-            sc = set_new == False
++            sc = set_new is False
+             self._update_cookie_out(set_cookie=sc)
+     @property
+diff --git a/tests/test_session.py b/tests/test_session.py
+index 82ed74d..926dabb 100644
+--- a/tests/test_session.py
++++ b/tests/test_session.py
+@@ -218,7 +218,8 @@ def test_cookies_enabled():
+     # test for secure
+     session = get_session(use_cookies=True, secure=True)
+-    assert 'secure' in session.request['cookie_out']
++    cookie = session.request['cookie_out'].lower()  # Python3.4.3 outputs "Secure", while previous output "secure"
++    assert 'secure' in cookie, cookie
+     # test for httponly
+     class ShowWarning(object):
+@@ -233,7 +234,9 @@ def __call__(self, message, category, filename, lineno, file=None, line=None):
+     if sys.version_info < (2, 6):
+         assert sw.msg == 'Python 2.6+ is required to use httponly'
+     else:
+-        assert 'httponly' in session.request['cookie_out']
++        # Python3.4.3 outputs "HttpOnly", while previous output "httponly"
++        cookie = session.request['cookie_out'].lower()
++        assert 'httponly' in cookie, cookie
+     warnings.showwarning = orig_sw
+ def test_cookies_disabled():
+