Backport PR #317 (call reset from setUp / tearDown)

This commit is contained in:
Adam Williamson 2017-01-27 23:54:40 +01:00
parent b474483eb2
commit a4977cf41f
2 changed files with 45 additions and 1 deletions

View File

@ -0,0 +1,37 @@
From 01474bf64e0434881059a3638abff5bb62eaedb1 Mon Sep 17 00:00:00 2001
From: Scott Moser <smoser@brickies.net>
Date: Tue, 24 Jan 2017 12:30:47 -0500
Subject: [PATCH] Call reset from setUp and tearDown in addition to enable and
disable.
When decorating a class via setUp and tearDown, reset() was not being
called. That was an unintentional change in behavior from previous versions.
Addresses #316.
---
httpretty/core.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/httpretty/core.py b/httpretty/core.py
index 34d1ed1..c408c38 100644
--- a/httpretty/core.py
+++ b/httpretty/core.py
@@ -1189,6 +1189,7 @@ def httprettified(test):
if hasattr(klass, 'setUp')
else None)
def new_setUp(self):
+ httpretty.reset()
httpretty.enable()
if use_addCleanup:
self.addCleanup(httpretty.disable)
@@ -1202,6 +1203,7 @@ def httprettified(test):
else None)
def new_tearDown(self):
httpretty.disable()
+ httpretty.reset()
if original_tearDown:
original_tearDown(self)
klass.tearDown = new_tearDown
--
2.9.3

View File

@ -16,7 +16,7 @@
Name: python-httpretty
Version: 0.8.14
# If github_date is defined, assume a post-release snapshot
Release: 1%{?github_date:.%{github_date}git%{shortcommit}}%{?dist}
Release: 2%{?github_date:.%{github_date}git%{shortcommit}}%{?dist}
Summary: HTTP request mock tool for Python
License: MIT
@ -56,6 +56,10 @@ Patch2: python-httpretty-fakesock_getpeercert_noconnect.patch
# https://github.com/gabrielfalcao/HTTPretty/pull/315
Patch3: 0001-Handle-bugs-in-older-urllib3-versions-in-one-of-the-.patch
# Fix setUp and tearDown not calling reset
# https://github.com/gabrielfalcao/HTTPretty/pull/317
Patch4: 0001-Call-reset-from-setUp-and-tearDown-in-addition-to-en.patch
BuildArch: noarch
Requires: python-urllib3
@ -180,6 +184,9 @@ popd
%changelog
* Fri Jan 27 2017 Adam Williamson <awilliam@redhat.com> - 0.8.14-2.20161011git70af1f8
- Backport PR #317 (call reset from setUp / tearDown) - thanks gholms
* Fri Jan 06 2017 Adam Williamson <awilliam@redhat.com> - 0.8.14-1.20161011git70af1f8
- Update to current git master (as a 0.8.14 post-release snapshot)
- Backport PR #313 (fix with recent OpenSSL, requests and urllib3)