diff options
author | Scott Moser <smoser@brickies.net> | 2017-01-24 11:37:08 -0500 |
---|---|---|
committer | Scott Moser <smoser@brickies.net> | 2017-01-24 15:39:14 -0500 |
commit | 8e9e47f2f06b4dcf017149699111e94ba7c1830b (patch) | |
tree | cc075e0497d555d41356a178ecfe958b36fa4c42 /tests/unittests/helpers.py | |
parent | 853df0a0e85002582694b88db886f206f64b23c7 (diff) | |
download | vyos-cloud-init-8e9e47f2f06b4dcf017149699111e94ba7c1830b.tar.gz vyos-cloud-init-8e9e47f2f06b4dcf017149699111e94ba7c1830b.zip |
tests: No longer monkey patch httpretty for python 3.4.2
No shipping ubuntu has a python 3.4 that is less than 3.4.2.
Remove this workaround to avoid unnecessary complexity.
This reverts 04a60cf949.
Diffstat (limited to 'tests/unittests/helpers.py')
-rw-r--r-- | tests/unittests/helpers.py | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/tests/unittests/helpers.py b/tests/unittests/helpers.py index 64e56d98..a0933464 100644 --- a/tests/unittests/helpers.py +++ b/tests/unittests/helpers.py @@ -2,7 +2,6 @@ from __future__ import print_function -import functools import os import shutil import sys @@ -29,7 +28,6 @@ PY2 = False PY26 = False PY27 = False PY3 = False -FIX_HTTPRETTY = False _PY_VER = sys.version_info _PY_MAJOR, _PY_MINOR, _PY_MICRO = _PY_VER[0:3] @@ -44,8 +42,6 @@ else: PY2 = True if (_PY_MAJOR, _PY_MINOR) >= (3, 0): PY3 = True - if _PY_MINOR == 4 and _PY_MICRO < 3: - FIX_HTTPRETTY = True # Makes the old path start @@ -216,37 +212,6 @@ class FilesystemMockingTestCase(ResourceUsingTestCase): return root -def import_httpretty(): - """Import HTTPretty and monkey patch Python 3.4 issue. - See https://github.com/gabrielfalcao/HTTPretty/pull/193 and - as well as https://github.com/gabrielfalcao/HTTPretty/issues/221. - - Lifted from - https://github.com/inveniosoftware/datacite/blob/master/tests/helpers.py - """ - if not FIX_HTTPRETTY: - import httpretty - else: - import socket - old_SocketType = socket.SocketType - - import httpretty - from httpretty import core - - def sockettype_patch(f): - @functools.wraps(f) - def inner(*args, **kwargs): - f(*args, **kwargs) - socket.SocketType = old_SocketType - socket.__dict__['SocketType'] = old_SocketType - return inner - - core.httpretty.disable = sockettype_patch( - httpretty.httpretty.disable - ) - return httpretty - - class HttprettyTestCase(TestCase): # necessary as http_proxy gets in the way of httpretty # https://github.com/gabrielfalcao/HTTPretty/issues/122 |