[arch-commits] Commit in python-vcrpy/trunk (PKGBUILD fix-urllib-redirect-tests.patch)
Evangelos Foutras
foutrelis at gemini.archlinux.org
Thu Dec 2 18:23:34 UTC 2021
Date: Thursday, December 2, 2021 @ 18:23:34
Author: foutrelis
Revision: 1062128
Fix urllib redirect tests
Added:
python-vcrpy/trunk/fix-urllib-redirect-tests.patch
Modified:
python-vcrpy/trunk/PKGBUILD
---------------------------------+
PKGBUILD | 11 +++++-
fix-urllib-redirect-tests.patch | 60 ++++++++++++++++++++++++++++++++++++++
2 files changed, 69 insertions(+), 2 deletions(-)
Modified: PKGBUILD
===================================================================
--- PKGBUILD 2021-12-02 18:18:37 UTC (rev 1062127)
+++ PKGBUILD 2021-12-02 18:23:34 UTC (rev 1062128)
@@ -10,9 +10,16 @@
depends=('python-yaml' 'python-wrapt' 'python-six' 'python-yarl')
makedepends=('python-setuptools')
checkdepends=('python-pytest-runner' 'python-pytest-httpbin' 'python-mock')
-source=("$pkgname-$pkgver.tar.gz::https://github.com/kevin1024/vcrpy/archive/v$pkgver.tar.gz")
-sha512sums=('afa1904bff37bfd2d278ed49fa3982a357eb6bb113818b532044da0f11a9dd877cc152d7f0d81d88bdc0f870521b1241f6aecf959f668211904e3c6c7cea4ad8')
+source=("$pkgname-$pkgver.tar.gz::https://github.com/kevin1024/vcrpy/archive/v$pkgver.tar.gz"
+ fix-urllib-redirect-tests.patch)
+sha512sums=('afa1904bff37bfd2d278ed49fa3982a357eb6bb113818b532044da0f11a9dd877cc152d7f0d81d88bdc0f870521b1241f6aecf959f668211904e3c6c7cea4ad8'
+ 'abe9cbb99e83e8bc521ec7e744f52580b410ed88c1dfaa441174ced526460389ffba0decccc4483e50fd9ec68c94388ec5cc1abd668abd88ce057db25a8e9b8d')
+prepare() {
+ cd vcrpy-$pkgver
+ patch -Np1 -i ../fix-urllib-redirect-tests.patch
+}
+
build() {
cd vcrpy-$pkgver
python setup.py build
Added: fix-urllib-redirect-tests.patch
===================================================================
--- fix-urllib-redirect-tests.patch (rev 0)
+++ fix-urllib-redirect-tests.patch 2021-12-02 18:23:34 UTC (rev 1062128)
@@ -0,0 +1,60 @@
+From cd722780620dfcd6d3cec813ff45c30ce7892342 Mon Sep 17 00:00:00 2001
+From: Jair Henrique <jair.henrique at gmail.com>
+Date: Tue, 2 Nov 2021 16:15:04 -0300
+Subject: [PATCH] Fix urllib redirect tests
+
+---
+ tests/integration/test_urllib2.py | 7 ++++---
+ tests/integration/test_urllib3.py | 10 ++++++----
+ 2 files changed, 10 insertions(+), 7 deletions(-)
+
+diff --git a/tests/integration/test_urllib2.py b/tests/integration/test_urllib2.py
+index 2582e0cb..dd74bd58 100644
+--- a/tests/integration/test_urllib2.py
++++ b/tests/integration/test_urllib2.py
+@@ -56,12 +56,13 @@ def test_response_headers(httpbin_both, tmpdir):
+ assert sorted(open1) == sorted(open2)
+
+
+-def test_effective_url(httpbin_both, tmpdir):
++def test_effective_url(tmpdir):
+ """Ensure that the effective_url is captured"""
+- url = httpbin_both.url + "/redirect-to?url=/html"
++ url = "http://mockbin.org/redirect/301"
++
+ with vcr.use_cassette(str(tmpdir.join("headers.yaml"))):
+ effective_url = urlopen_with_cafile(url).geturl()
+- assert effective_url == httpbin_both.url + "/html"
++ assert effective_url == "http://mockbin.org/redirect/301/0"
+
+ with vcr.use_cassette(str(tmpdir.join("headers.yaml"))):
+ assert effective_url == urlopen_with_cafile(url).geturl()
+diff --git a/tests/integration/test_urllib3.py b/tests/integration/test_urllib3.py
+index 110c05af..01de5a85 100644
+--- a/tests/integration/test_urllib3.py
++++ b/tests/integration/test_urllib3.py
+@@ -94,9 +94,10 @@ def test_post(tmpdir, httpbin_both, verify_pool_mgr):
+ assert req1 == req2
+
+
+-def test_redirects(tmpdir, httpbin_both, verify_pool_mgr):
++def test_redirects(tmpdir, verify_pool_mgr):
+ """Ensure that we can handle redirects"""
+- url = httpbin_both.url + "/redirect-to?url=bytes/1024"
++ url = "http://mockbin.org/redirect/301"
++
+ with vcr.use_cassette(str(tmpdir.join("verify_pool_mgr.yaml"))):
+ content = verify_pool_mgr.request("GET", url).data
+
+@@ -104,8 +105,9 @@ def test_redirects(tmpdir, httpbin_both, verify_pool_mgr):
+ assert content == verify_pool_mgr.request("GET", url).data
+ # Ensure that we've now cached *two* responses. One for the redirect
+ # and one for the final fetch
+- assert len(cass) == 2
+- assert cass.play_count == 2
++
++ assert len(cass) == 2
++ assert cass.play_count == 2
+
+
+ def test_cross_scheme(tmpdir, httpbin, httpbin_secure, verify_pool_mgr):
More information about the arch-commits
mailing list