1
0
python-httpretty/460-miliseconds_tests.patch
Matej Cepl 68ccddc9e4 Accepting request 1031587 from home:AdaLovelace:branches:devel:languages:python
- Add patch 460-miliseconds_tests.patch (gh#gabrielfalcao/HTTPretty#460):
  * Correct tests for s390x and aarch64 because of timeout failures 
    after 2 miliseconds

OBS-URL: https://build.opensuse.org/request/show/1031587
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-httpretty?expand=0&rev=52
2022-10-27 17:01:22 +00:00

100 lines
3.8 KiB
Diff

From 2098d2cfb221995a2523fec3984641f4a15812cc Mon Sep 17 00:00:00 2001
From: Sarah Julia Kriesch <sarah-julia.kriesch@gmx.de>
Date: Thu, 27 Oct 2022 08:55:50 +0200
Subject: [PATCH 1/2] Fix build issues based on tests with the requirement of 2
miliseconds #459
Signed-off-by: Sarah Julia Kriesch <sarah-julia.kriesch@gmx.de>
---
tests/functional/test_httplib2.py | 9 +++------
tests/functional/test_urllib2.py | 7 ++-----
2 files changed, 5 insertions(+), 11 deletions(-)
diff --git a/tests/functional/test_httplib2.py b/tests/functional/test_httplib2.py
index c913d8a8..6cb27e1b 100644
--- a/tests/functional/test_httplib2.py
+++ b/tests/functional/test_httplib2.py
@@ -112,8 +112,7 @@ def test_httpretty_should_allow_adding_and_overwritting_httplib2():
@httprettified
-@within(two=miliseconds)
-def test_httpretty_should_allow_forcing_headers_httplib2(now):
+def test_httpretty_should_allow_forcing_headers_httplib2():
"HTTPretty should allow forcing headers with httplib2"
HTTPretty.register_uri(HTTPretty.GET, "http://github.com/foo",
@@ -165,8 +164,7 @@ def test_httpretty_should_allow_adding_and_overwritting_by_kwargs_u2():
@httprettified
-@within(two=miliseconds)
-def test_rotating_responses_with_httplib2(now):
+def test_rotating_responses_with_httplib2():
"HTTPretty should support rotating responses with httplib2"
HTTPretty.register_uri(
@@ -248,8 +246,7 @@ def test_can_inspect_last_request_with_ssl(now):
@httprettified
-@within(two=miliseconds)
-def test_httpretty_ignores_querystrings_from_registered_uri(now):
+def test_httpretty_ignores_querystrings_from_registered_uri():
"Registering URIs with query string cause them to be ignored"
HTTPretty.register_uri(HTTPretty.GET, "http://yipit.com/?id=123",
diff --git a/tests/functional/test_urllib2.py b/tests/functional/test_urllib2.py
index 9c8ff39f..4cba7253 100644
--- a/tests/functional/test_urllib2.py
+++ b/tests/functional/test_urllib2.py
@@ -127,7 +127,6 @@ def test_httpretty_should_allow_adding_and_overwritting_urllib2():
@httprettified
-@within(two=miliseconds)
def test_httpretty_should_allow_forcing_headers_urllib2():
"HTTPretty should allow forcing headers with urllib2"
@@ -177,8 +176,7 @@ def test_httpretty_should_allow_adding_and_overwritting_by_kwargs_u2():
@httprettified
-@within(two=miliseconds)
-def test_httpretty_should_support_a_list_of_successive_responses_urllib2(now):
+def test_httpretty_should_support_a_list_of_successive_responses_urllib2():
("HTTPretty should support adding a list of successive "
"responses with urllib2")
@@ -285,8 +283,7 @@ def test_httpretty_ignores_querystrings_from_registered_uri():
@httprettified
-@within(two=miliseconds)
-def test_callback_response(now):
+def test_callback_response():
("HTTPretty should call a callback function to be set as the body with"
" urllib2")
From 063a58bb8a7c2f213c07b343a5e1fe48944f1f08 Mon Sep 17 00:00:00 2001
From: Sarah Julia Kriesch <sarah-julia.kriesch@gmx.de>
Date: Thu, 27 Oct 2022 09:20:40 +0200
Subject: [PATCH 2/2] Fix asertion error with 0,24 instead of 0,2 #459
Signed-off-by: Sarah Julia Kriesch <sarah-julia.kriesch@gmx.de>
---
tests/bugfixes/nosetests/test_430_respect_timeout.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/bugfixes/nosetests/test_430_respect_timeout.py b/tests/bugfixes/nosetests/test_430_respect_timeout.py
index f21a5468..ed5866b9 100644
--- a/tests/bugfixes/nosetests/test_430_respect_timeout.py
+++ b/tests/bugfixes/nosetests/test_430_respect_timeout.py
@@ -51,4 +51,4 @@ def my_callback(request, url, headers):
# And the total execution time should be less than 0.2 seconds
event.set()
total_time = time.time() - started_at
- total_time.should.be.lower_than(0.2)
+ total_time.should.be.lower_than(0.24)