Hello community, here is the log from the commit of package python-mocket for openSUSE:Factory checked in at 2020-04-01 19:19:48 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-mocket (Old) and /work/SRC/openSUSE:Factory/.python-mocket.new.3248 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-mocket" Wed Apr 1 19:19:48 2020 rev:2 rq:790553 version:3.8.4 Changes: -------- --- /work/SRC/openSUSE:Factory/python-mocket/python-mocket.changes 2019-09-23 12:36:09.389622408 +0200 +++ /work/SRC/openSUSE:Factory/.python-mocket.new.3248/python-mocket.changes 2020-04-01 19:20:03.603577594 +0200 @@ -1,0 +2,10 @@ +Wed Apr 1 07:38:18 UTC 2020 - pgaj...@suse.com + +- version update to 3.8.4 + * Adding missing `load_verify_locations` method + * Removing `hexdump` dependency + * Fix for removing DeprecationWarning (#105) + * Py3.8 classifier + * Fix for Redis module + +------------------------------------------------------------------- Old: ---- mocket-3.7.3.tar.gz New: ---- mocket-3.8.4.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-mocket.spec ++++++ --- /var/tmp/diff_new_pack.3cvGaP/_old 2020-04-01 19:20:04.291577904 +0200 +++ /var/tmp/diff_new_pack.3cvGaP/_new 2020-04-01 19:20:04.295577906 +0200 @@ -1,7 +1,7 @@ # # spec file for package python-mocket # -# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,7 +18,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-mocket -Version: 3.7.3 +Version: 3.8.4 Release: 0 Summary: Python socket mock framework License: BSD-3-Clause @@ -29,7 +29,6 @@ BuildRequires: fdupes BuildRequires: python-rpm-macros Requires: python-decorator -Requires: python-hexdump Requires: python-python-magic Requires: python-six Requires: python-urllib3 @@ -44,7 +43,6 @@ BuildRequires: %{python_module cryptography} BuildRequires: %{python_module decorator} BuildRequires: %{python_module gevent} -BuildRequires: %{python_module hexdump} BuildRequires: %{python_module mock} BuildRequires: %{python_module pyOpenSSL} BuildRequires: %{python_module pytest} @@ -78,9 +76,7 @@ %install export LANG=en_US.UTF-8 %python_install -%{python_expand rm -r %{buildroot}%{$python_sitelib}/tests -%fdupes %{buildroot}%{$python_sitelib} -} +%python_expand %fdupes %{buildroot}%{$python_sitelib} %check export LANG=en_US.UTF-8 ++++++ mocket-3.7.3.tar.gz -> mocket-3.8.4.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-mocket-3.7.3/.travis.yml new/python-mocket-3.8.4/.travis.yml --- old/python-mocket-3.7.3/.travis.yml 2019-09-18 09:15:32.000000000 +0200 +++ new/python-mocket-3.8.4/.travis.yml 2020-02-24 12:32:41.000000000 +0100 @@ -8,7 +8,7 @@ - "3.5" - "3.6" - "3.7" - - "3.8-dev" + - "3.8" - "pypy" - "pypy3.5-6.0" install: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-mocket-3.7.3/MANIFEST.in new/python-mocket-3.8.4/MANIFEST.in --- old/python-mocket-3.7.3/MANIFEST.in 2019-09-18 09:15:32.000000000 +0200 +++ new/python-mocket-3.8.4/MANIFEST.in 2020-02-24 12:32:41.000000000 +0100 @@ -1 +1,5 @@ -include README.rst LICENSE *.txt \ No newline at end of file +include README.rst LICENSE *.txt +recursive-include tests *.json +recursive-include tests *.png +recursive-include tests *.py +recursive-include tests *.txt diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-mocket-3.7.3/Makefile new/python-mocket-3.8.4/Makefile --- old/python-mocket-3.7.3/Makefile 2019-09-18 09:15:32.000000000 +0200 +++ new/python-mocket-3.8.4/Makefile 2020-02-24 12:32:41.000000000 +0100 @@ -14,7 +14,7 @@ lint-python: @echo "Linting Python files" - flake8 --ignore=E501,E731 --exclude=.git,compat.py mocket + flake8 --ignore=E501,E731,W503 --exclude=.git,compat.py mocket @echo "" develop: install-test-requirements install-dev-requirements @@ -31,7 +31,7 @@ export SKIP_TRUE_REDIS=1; export SKIP_TRUE_HTTP=1; make test publish: - python setup.py sdist bdist_wheel + python setup.py sdist pip install -U twine twine upload dist/mocket-$(shell python -c 'import mocket; print(mocket.__version__)')*.* pip install -U anaconda-client diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-mocket-3.7.3/mocket/__init__.py new/python-mocket-3.8.4/mocket/__init__.py --- old/python-mocket-3.7.3/mocket/__init__.py 2019-09-18 09:15:32.000000000 +0200 +++ new/python-mocket-3.8.4/mocket/__init__.py 2020-02-24 12:32:41.000000000 +0100 @@ -5,6 +5,6 @@ # Py3 from mocket.mocket import mocketize, Mocket, MocketEntry, Mocketizer -__all__ = (mocketize, Mocket, MocketEntry, Mocketizer) +__all__ = ("mocketize", "Mocket", "MocketEntry", "Mocketizer") -__version__ = "3.7.3" +__version__ = "3.8.4" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-mocket-3.7.3/mocket/compat.py new/python-mocket-3.8.4/mocket/compat.py --- old/python-mocket-3.7.3/mocket/compat.py 2019-09-18 09:15:32.000000000 +0200 +++ new/python-mocket-3.8.4/mocket/compat.py 2020-02-24 12:32:41.000000000 +0100 @@ -2,6 +2,7 @@ import os import shlex import sys +from socket import error as sock_error import six @@ -13,6 +14,7 @@ PY2 = sys.version_info[0] == 2 if PY2: + import collections as collections_abc from BaseHTTPServer import BaseHTTPRequestHandler from urlparse import urlsplit, parse_qs, unquote @@ -26,11 +28,14 @@ return s FileNotFoundError = IOError + BlockingIOError = sock_error else: + import collections.abc as collections_abc from http.server import BaseHTTPRequestHandler from urllib.parse import urlsplit, parse_qs, unquote as unquote_utf8 FileNotFoundError = FileNotFoundError + BlockingIOError = BlockingIOError try: from json.decoder import JSONDecodeError diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-mocket-3.7.3/mocket/mocket.py new/python-mocket-3.8.4/mocket/mocket.py --- old/python-mocket-3.7.3/mocket/mocket.py 2019-09-18 09:15:32.000000000 +0200 +++ new/python-mocket-3.8.4/mocket/mocket.py 2020-02-24 12:32:41.000000000 +0100 @@ -1,6 +1,7 @@ from __future__ import unicode_literals import collections +import errno import hashlib import io import json @@ -11,21 +12,22 @@ from datetime import datetime, timedelta import decorator -import hexdump import urllib3 from urllib3.util.ssl_ import ssl_wrap_socket as urllib3_ssl_wrap_socket from urllib3.util.ssl_ import wrap_socket as urllib3_wrap_socket from .compat import ( + BlockingIOError, FileNotFoundError, JSONDecodeError, basestring, byte_type, + collections_abc, decode_from_bytes, encode_to_bytes, text_type, ) -from .utils import SSL_PROTOCOL, MocketSocketCore, wrap_ssl_socket +from .utils import SSL_PROTOCOL, MocketSocketCore, hexdump, hexload, wrap_ssl_socket xxh32 = None try: @@ -93,6 +95,10 @@ pass @staticmethod + def load_verify_locations(*args, **kwargs): + pass + + @staticmethod def wrap_socket(sock=sock, *args, **kwargs): sock.kwargs = kwargs sock._secure_socket = True @@ -104,7 +110,8 @@ return ssl_obj def __getattr__(self, name): - return getattr(self.sock, name) + if self.sock is not None: + return getattr(self.sock, name) def create_connection( @@ -263,12 +270,20 @@ return self.fd.read(buffersize) def recv_into(self, buffer, buffersize=None, flags=None): - return buffer.write(self.fd.read(buffersize)) + return buffer.write(self.read(buffersize)) def recv(self, buffersize, flags=None): if Mocket.r_fd and Mocket.w_fd: return os.read(Mocket.r_fd, buffersize) - return self.fd.read(buffersize) + if self.fd is not None: + data = self.read(buffersize) + if data: + return data + # used by Redis mock + exc = BlockingIOError() + exc.errno = errno.EWOULDBLOCK + exc.args = (0,) + raise exc def true_sendall(self, data, *args, **kwargs): req = decode_from_bytes(data) @@ -311,13 +326,7 @@ # try to get the response from the dictionary try: - try: - encoded_response = hexdump.dehex(response_dict["response"]) - except TypeError: # pragma: no cover - # Python 2 - encoded_response = hexdump.restore( - encode_to_bytes(response_dict["response"]) - ) + encoded_response = hexload(response_dict["response"]) # if not available, call the real sendall except KeyError: host, port = Mocket._address @@ -344,9 +353,10 @@ encoded_response = b"" # https://github.com/kennethreitz/requests/blob/master/tests/testserver/server.py#L13 while True: - if not select.select( - [self.true_socket], [], [], 0.1 - )[0] and encoded_response: + if ( + not select.select([self.true_socket], [], [], 0.1)[0] + and encoded_response + ): break recv = self.true_socket.recv(self._buflen) @@ -359,7 +369,7 @@ # update the dictionary with request and response lines response_dict["request"] = req - response_dict["response"] = hexdump.dump(encoded_response) + response_dict["response"] = hexdump(encoded_response) with io.open(path, mode="w") as f: f.write( @@ -533,7 +543,7 @@ self.location = location self.response_index = 0 - if not isinstance(responses, collections.Iterable) or isinstance( + if not isinstance(responses, collections_abc.Iterable) or isinstance( responses, basestring ): responses = [responses] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-mocket-3.7.3/mocket/plugins/httpretty/__init__.py new/python-mocket-3.8.4/mocket/plugins/httpretty/__init__.py --- old/python-mocket-3.7.3/mocket/plugins/httpretty/__init__.py 2019-09-18 09:15:32.000000000 +0200 +++ new/python-mocket-3.8.4/mocket/plugins/httpretty/__init__.py 2020-02-24 12:32:41.000000000 +0100 @@ -1,23 +1,33 @@ from mocket import mocketize, Mocket -from mocket.mockhttp import Entry as MocketHttpEntry, Response as MocketHttpResponse, STATUS, CRLF +from mocket.mockhttp import ( + Entry as MocketHttpEntry, + Response as MocketHttpResponse, + STATUS, + CRLF, +) from mocket.compat import text_type, byte_type, encode_to_bytes def httprettifier_headers(headers): - return {k.lower().replace('_', '-'): v for k, v in headers.items()} + return {k.lower().replace("_", "-"): v for k, v in headers.items()} class Response(MocketHttpResponse): def get_protocol_data(self): - status_line = 'HTTP/1.1 {status_code} {status}'.format(status_code=self.status, status=STATUS[self.status]) - if 'server' in self.headers and self.headers['server'] == 'Python/Mocket': - self.headers['server'] = 'Python/HTTPretty' - header_lines = CRLF.join(['{0}: {1}'.format(k.lower(), v) for k, v in self.headers.items()]) - return '{0}\r\n{1}\r\n\r\n'.format(status_line, header_lines).encode('utf-8') + status_line = "HTTP/1.1 {status_code} {status}".format( + status_code=self.status, status=STATUS[self.status] + ) + if "server" in self.headers and self.headers["server"] == "Python/Mocket": + self.headers["server"] = "Python/HTTPretty" + header_lines = CRLF.join( + ["{0}: {1}".format(k.lower(), v) for k, v in self.headers.items()] + ) + return "{0}\r\n{1}\r\n\r\n".format(status_line, header_lines).encode("utf-8") def set_base_headers(self): super(Response, self).set_base_headers() self.headers = httprettifier_headers(self.headers) + original_set_base_headers = set_base_headers def set_extra_headers(self, headers): @@ -46,7 +56,7 @@ def register_uri( method, uri, - body='HTTPretty :)', + body="HTTPretty :)", adding_headers=None, forcing_headers=None, status=200, @@ -62,8 +72,10 @@ headers.update(httprettifier_headers(adding_headers)) if forcing_headers is not None: + def force_headers(self): self.headers = httprettifier_headers(forcing_headers) + Response.set_base_headers = force_headers else: Response.set_base_headers = Response.original_set_base_headers @@ -72,7 +84,12 @@ Entry.register(method, uri, *responses) else: Entry.single_register( - method, uri, body=body, status=status, headers=headers, match_querystring=match_querystring + method, + uri, + body=body, + status=status, + headers=headers, + match_querystring=match_querystring, ) @@ -84,12 +101,12 @@ pass def __getattr__(self, name): - if name == 'last_request': - last_request = getattr(Mocket, 'last_request')() + if name == "last_request": + last_request = getattr(Mocket, "last_request")() last_request.body = encode_to_bytes(last_request.body) return last_request - elif name == 'latest_requests': - return getattr(Mocket, '_requests') + elif name == "latest_requests": + return getattr(Mocket, "_requests") else: return getattr(Entry, name) @@ -99,6 +116,20 @@ __all__ = ( - HTTPretty, activate, httprettified, enable, disable, reset, Response, GET, PUT, POST, DELETE, HEAD, PATCH, - register_uri, text_type, byte_type + "HTTPretty", + "activate", + "httprettified", + "enable", + "disable", + "reset", + "Response", + "GET", + "PUT", + "POST", + "DELETE", + "HEAD", + "PATCH", + "register_uri", + "text_type", + "byte_type", ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-mocket-3.7.3/mocket/utils.py new/python-mocket-3.8.4/mocket/utils.py --- old/python-mocket-3.7.3/mocket/utils.py 2019-09-18 09:15:32.000000000 +0200 +++ new/python-mocket-3.8.4/mocket/utils.py 2020-02-24 12:32:41.000000000 +0100 @@ -1,7 +1,9 @@ +import codecs import io import os import ssl +from .compat import decode_from_bytes, encode_to_bytes SSL_PROTOCOL = ssl.PROTOCOL_SSLv23 @@ -43,3 +45,21 @@ ciphers=ciphers, _context=context, ) + + +def hexdump(binary_string): + r""" + >>> hexdump(b"bar foobar foo") == decode_from_bytes(encode_to_bytes("62 61 72 20 66 6F 6F 62 61 72 20 66 6F 6F")) + True + """ + bs = decode_from_bytes(codecs.encode(binary_string, "hex_codec")).upper() + return " ".join(a + b for a, b in zip(bs[::2], bs[1::2])) + + +def hexload(string): + r""" + >>> hexload("62 61 72 20 66 6F 6F 62 61 72 20 66 6F 6F") == encode_to_bytes("bar foobar foo") + True + """ + string_no_spaces = "".join(string.split()) + return codecs.decode(encode_to_bytes(string_no_spaces), "hex_codec") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-mocket-3.7.3/requirements.txt new/python-mocket-3.8.4/requirements.txt --- old/python-mocket-3.7.3/requirements.txt 2019-09-18 09:15:32.000000000 +0200 +++ new/python-mocket-3.8.4/requirements.txt 2020-02-24 12:32:41.000000000 +0100 @@ -1,5 +1,4 @@ python-magic six decorator -hexdump urllib3 \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-mocket-3.7.3/setup.py new/python-mocket-3.8.4/setup.py --- old/python-mocket-3.7.3/setup.py 2019-09-18 09:15:32.000000000 +0200 +++ new/python-mocket-3.8.4/setup.py 2020-02-24 12:32:41.000000000 +0100 @@ -5,22 +5,26 @@ major, minor = sys.version_info[:2] -install_requires = io.open(os.path.join(os.path.dirname(__file__), 'requirements.txt')).readlines() -tests_requires = io.open(os.path.join(os.path.dirname(__file__), 'test_requirements.txt')).readlines() +install_requires = io.open( + os.path.join(os.path.dirname(__file__), "requirements.txt") +).readlines() +tests_requires = io.open( + os.path.join(os.path.dirname(__file__), "test_requirements.txt") +).readlines() -pook_requires = ('pook>=0.2.1', ) -exclude_packages = ('tests', ) +pook_requires = ("pook>=0.2.1",) +exclude_packages = ("tests", "tests.*") def read_version(package): - init_path = os.path.join(package, '__init__.py') - with io.open(init_path, 'r') as fd: + init_path = os.path.join(package, "__init__.py") + with io.open(init_path, "r") as fd: for line in fd: - if line.startswith('__version__ = '): + if line.startswith("__version__ = "): return line.split()[-1].strip().strip('"') -package_name = 'mocket' +package_name = "mocket" # Get package current version version = read_version(package_name) @@ -29,39 +33,39 @@ setup( name=package_name, version=read_version(package_name), - author='Giorgio Salluzzo', - author_email='giorgio.sallu...@gmail.com', - url='https://github.com/mindflayer/python-mocket', - description='Socket Mock Framework - for all kinds of socket animals, web-clients included - \ - with gevent/asyncio/SSL support', - long_description=io.open('README.rst', encoding='utf-8').read(), + author="Giorgio Salluzzo", + author_email="giorgio.sallu...@gmail.com", + url="https://github.com/mindflayer/python-mocket", + description="Socket Mock Framework - for all kinds of socket animals, web-clients included - \ + with gevent/asyncio/SSL support", + long_description=io.open("README.rst", encoding="utf-8").read(), packages=find_packages(exclude=exclude_packages), install_requires=install_requires, extras_require={ - 'speedups': [ + "speedups": [ 'xxhash;platform_python_implementation=="CPython"', - 'xxhash-cffi;platform_python_implementation=="PyPy"' + 'xxhash-cffi;platform_python_implementation=="PyPy"', ], - 'tests': tests_requires, - 'dev': [], - 'pook': pook_requires, # plugins version supporting mocket.plugins.pook.MocketEngine + "tests": tests_requires, + "dev": [], + "pook": pook_requires, # plugins version supporting mocket.plugins.pook.MocketEngine }, - test_suite='runtests.runtests', - license='BSD', + test_suite="runtests.runtests", + license="BSD", classifiers=[ - 'Development Status :: 5 - Production/Stable', - 'Intended Audience :: Developers', - 'Operating System :: OS Independent', - 'Programming Language :: Python :: 2.7', - 'Programming Language :: Python :: 3.3', - 'Programming Language :: Python :: 3.4', - 'Programming Language :: Python :: 3.5', - 'Programming Language :: Python :: 3.6', - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: Implementation :: CPython', - 'Programming Language :: Python :: Implementation :: PyPy', - 'Topic :: Software Development', - 'Topic :: Software Development :: Testing', - 'License :: OSI Approved :: BSD License', + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "Operating System :: OS Independent", + "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3.4", + "Programming Language :: Python :: 3.5", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: Implementation :: CPython", + "Programming Language :: Python :: Implementation :: PyPy", + "Topic :: Software Development", + "Topic :: Software Development :: Testing", + "License :: OSI Approved :: BSD License", ], ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-mocket-3.7.3/shippable.yaml new/python-mocket-3.8.4/shippable.yaml --- old/python-mocket-3.7.3/shippable.yaml 2019-09-18 09:15:32.000000000 +0200 +++ new/python-mocket-3.8.4/shippable.yaml 2020-02-24 12:32:41.000000000 +0100 @@ -6,6 +6,7 @@ - 3.5 - 3.6 - 3.7 + - 3.8 - pypy - pypy3 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-mocket-3.7.3/test_requirements.txt new/python-mocket-3.8.4/test_requirements.txt --- old/python-mocket-3.7.3/test_requirements.txt 2019-09-18 09:15:32.000000000 +0200 +++ new/python-mocket-3.8.4/test_requirements.txt 2020-02-24 12:32:41.000000000 +0100 @@ -3,7 +3,7 @@ pytest-cov mock requests -redis<3.2.0 +redis gevent sure pook