Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-requests-mock for openSUSE:Factory checked in at 2021-05-20 19:23:22 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-requests-mock (Old) and /work/SRC/openSUSE:Factory/.python-requests-mock.new.2988 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-requests-mock" Thu May 20 19:23:22 2021 rev:16 rq:894157 version:1.9.2 Changes: -------- --- /work/SRC/openSUSE:Factory/python-requests-mock/python-requests-mock.changes 2020-12-12 20:31:35.833804017 +0100 +++ /work/SRC/openSUSE:Factory/.python-requests-mock.new.2988/python-requests-mock.changes 2021-05-20 19:23:46.414263551 +0200 @@ -1,0 +2,25 @@ +Tue May 18 21:08:38 UTC 2021 - Dirk M??ller <dmuel...@suse.com> + +- update to 1.9.2: + * Add release note for urlquote fix + * Simple tests to ensure character encoding works + * Use requests to quote URLs + * Remove circleci badge from README + * Restore py.typed file to enable types + * Change tag pattern + * Url Quote the path provided to the mocker + * Use github action to push a release to PyPI (#163) + * Release note for type hints + * Add [PEP 484](https://www.python.org/dev/peps/pep-0484/) type hints + * Mocker.copy: Use correct type when copying mocker + * Run unit tests for pull requests as well + * Add support for Python up to 3.9 + * Use Github Actions + * Make is\_bound\_method private + * Add release note for fixed bug + * Correctly handle an explicit zero byte read + * Add missing string delimiter in example + * fix: is\_bound\_method by six + * fix: \`session\` and \`real\_http\` cannot be used at the same time + +------------------------------------------------------------------- Old: ---- requests-mock-1.8.0.tar.gz New: ---- requests-mock-1.9.2.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-requests-mock.spec ++++++ --- /var/tmp/diff_new_pack.qZ6uQI/_old 2021-05-20 19:23:46.930261367 +0200 +++ /var/tmp/diff_new_pack.qZ6uQI/_new 2021-05-20 19:23:46.934261351 +0200 @@ -1,7 +1,7 @@ # # spec file for package python-requests-mock # -# Copyright (c) 2020 SUSE LLC +# Copyright (c) 2021 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-requests-mock -Version: 1.8.0 +Version: 1.9.2 Release: 0 Summary: Module to mock out responses from the requests package License: Apache-2.0 ++++++ requests-mock-1.8.0.tar.gz -> requests-mock-1.9.2.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/requests-mock-1.8.0/.circleci/config.yml new/requests-mock-1.9.2/.circleci/config.yml --- old/requests-mock-1.8.0/.circleci/config.yml 2020-05-02 15:10:34.000000000 +0200 +++ new/requests-mock-1.9.2/.circleci/config.yml 1970-01-01 01:00:00.000000000 +0100 @@ -1,140 +0,0 @@ -version: 2 -jobs: - py36: - docker: - - image: circleci/python:3.6 - - steps: - - checkout - - - restore_cache: - keys: - - py36-dependencies-{{ checksum "requirements.txt" }}-{{ checksum "test-requirements.txt" }} - - - run: - name: install dependencies - command: | - python3 -m venv venv - source venv/bin/activate - pip3 install tox - tox -e py36 --notest - - - save_cache: - paths: - - ./venv - - .tox/py36 - key: py36-dependencies-{{ checksum "requirements.txt" }}-{{ checksum "test-requirements.txt" }} - - - run: - name: run tests - command: | - source venv/bin/activate - tox -e py36 - - py27: - docker: - - image: circleci/python:2.7 - - steps: - - checkout - - - restore_cache: - keys: - - py27-dependencies-{{ checksum "requirements.txt" }}-{{ checksum "test-requirements.txt" }} - - - run: - name: install dependencies - command: | - virtualenv venv - source venv/bin/activate - pip install tox - tox -e py27 --notest - - - save_cache: - paths: - - ./venv - - .tox/py27 - key: py27-dependencies-{{ checksum "requirements.txt" }}-{{ checksum "test-requirements.txt" }} - - - run: - name: run tests - command: | - source venv/bin/activate - tox -e py27 - - oldest: - docker: - - image: circleci/python:3.6 - - steps: - - checkout - - - restore_cache: - keys: - - oldest-dependencies-{{ checksum "requirements.txt" }}-{{ checksum "test-requirements.txt" }} - - - run: - name: install dependencies - command: | - python3 -m venv venv - source venv/bin/activate - pip3 install tox - tox -e oldest-requirements --notest - - - save_cache: - paths: - - ./venv - - .tox/py36 - key: oldest-dependencies-{{ checksum "requirements.txt" }}-{{ checksum "test-requirements.txt" }} - - - run: - name: run tests - command: | - source venv/bin/activate - tox -e py36 - - pypi: - docker: - - image: circleci/python:3.6 - - steps: - - checkout - - - run: - name: Upload to PyPI - command: | - python3 -m venv venv - source venv/bin/activate - pip install twine wheel reno - python setup.py sdist bdist_wheel - twine upload dist/* - -workflows: - version: 2 - build_and_release: - jobs: - - py27: - filters: - tags: - only: /^\d+\.\d+\.\d+$/ - - - py36: - filters: - tags: - only: /^\d+\.\d+\.\d+$/ - - - oldest: - filters: - tags: - only: /^\d+\.\d+\.\d+$/ - - - pypi: - requires: - - py27 - - py36 - - oldest - filters: - branches: - ignore: /.*/ - tags: - only: /^\d+\.\d+\.\d+$/ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/requests-mock-1.8.0/.github/workflows/flake8.yaml new/requests-mock-1.9.2/.github/workflows/flake8.yaml --- old/requests-mock-1.8.0/.github/workflows/flake8.yaml 1970-01-01 01:00:00.000000000 +0100 +++ new/requests-mock-1.9.2/.github/workflows/flake8.yaml 2021-04-30 05:36:39.000000000 +0200 @@ -0,0 +1,25 @@ +name: Lint + +on: + - push + +jobs: + flake8: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.x' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + pip install flake8 + + - name: Lint with flake8 + run: flake8 requests_mock tests diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/requests-mock-1.8.0/.github/workflows/release.yaml new/requests-mock-1.9.2/.github/workflows/release.yaml --- old/requests-mock-1.8.0/.github/workflows/release.yaml 1970-01-01 01:00:00.000000000 +0100 +++ new/requests-mock-1.9.2/.github/workflows/release.yaml 2021-04-30 05:36:39.000000000 +0200 @@ -0,0 +1,78 @@ +name: Create Release + +on: + push: + tags: + - '[0-9]+.[0-9]+.[0-9]+' + +jobs: + build: + name: Build Release Objects + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - uses: actions/setup-python@v2 + with: + python-version: '3.x' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install setuptools wheel reno + + - name: Build and publish + run: | + python setup.py sdist bdist_wheel + + - uses: actions/upload-artifact@v2 + with: + name: dist + path: dist + if-no-files-found: error + + pypi: + name: Create Github Release + runs-on: ubuntu-latest + needs: build + steps: + - name: Get artifacts + uses: actions/download-artifact@v2 + with: + name: dist + path: dist + + - name: Create Release + id: create_release + uses: softprops/action-gh-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + # name: ${{ github.ref }} + # prerelease: true + # draft: true + files: | + dist/* + + release: + name: Push to PyPI + runs-on: ubuntu-latest + needs: build + steps: + - name: Get artifacts + uses: actions/download-artifact@v2 + with: + name: dist + path: dist + + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + user: __token__ + packages_dir: dist/ + password: ${{ secrets.PYPI_TOKEN }} + # password: ${{ secrets.TEST_PYPI_TOKEN }} + # repository_url: https://test.pypi.org/legacy/ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/requests-mock-1.8.0/.github/workflows/unit-test.yaml new/requests-mock-1.9.2/.github/workflows/unit-test.yaml --- old/requests-mock-1.8.0/.github/workflows/unit-test.yaml 1970-01-01 01:00:00.000000000 +0100 +++ new/requests-mock-1.9.2/.github/workflows/unit-test.yaml 2021-04-30 05:36:39.000000000 +0200 @@ -0,0 +1,71 @@ +name: Unit Tests + +on: + - push + - pull_request + +jobs: + unittest: + runs-on: ubuntu-latest + + strategy: + matrix: + python-version: + - 2.7 + - 3.6 + - 3.7 + - 3.8 + - 3.9 + + steps: + - uses: actions/checkout@v2 + + - uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + architecture: 'x64' + + - uses: actions/cache@v2 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}-${{ hashFiles('test-requirements.txt') }} + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install -r requirements.txt -r test-requirements.txt pbr + pip install -e . + + - name: Test Testtools + run: python setup.py testr + + - name: Test PyTest + run: pytest tests/pytest + + oldest: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - uses: actions/setup-python@v2 + with: + python-version: '3.x' + architecture: 'x64' + + - uses: actions/cache@v2 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-oldest-${{ hashFiles('oldest-requirements.txt') }}-${{ hashFiles('test-requirements.txt') }} + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install -r oldest-requirements.txt -r test-requirements.txt pbr + pip install -e . + + - name: Test Testtools + run: python setup.py testr + + - name: Test PyTest + run: pytest tests/pytest diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/requests-mock-1.8.0/.tox.oldest.txt new/requests-mock-1.9.2/.tox.oldest.txt --- old/requests-mock-1.8.0/.tox.oldest.txt 2020-05-02 15:10:34.000000000 +0200 +++ new/requests-mock-1.9.2/.tox.oldest.txt 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ -requests==2.0.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/requests-mock-1.8.0/AUTHORS new/requests-mock-1.9.2/AUTHORS --- old/requests-mock-1.8.0/AUTHORS 2020-05-02 15:10:52.000000000 +0200 +++ new/requests-mock-1.9.2/AUTHORS 2021-04-30 05:36:44.000000000 +0200 @@ -1,4 +1,5 @@ Alex Peters <a...@peters.net> +Allan Lewis <allanlewi...@gmail.com> Andreas Jaeger <a...@suse.com> Arjan Keeman <arjan.kee...@falckon.nl> Colas Le Guernic <clslg...@users.noreply.github.com> @@ -8,14 +9,18 @@ Jamie Lennox <ja...@vibrato.com.au> Jamie Lennox <jamielen...@gmail.com> Jamie Lennox <jamielen...@redhat.com> +Janne Pulkkinen <janne.pulkki...@protonmail.com> Janonymous <janonymous.codevult...@gmail.com> Jeremy Stanley <fu...@yuggoth.org> +Jochen Kupperschmidt <homew...@nwsnet.de> Jon Dufresne <jon.dufre...@gmail.com> Louis Taylor <lo...@kragniz.eu> Manuel Kaufmann <humi...@gmail.com> Matthias Bilger <matth...@bilger.info> +Miroslav ??ediv?? <6774676+eum...@users.noreply.github.com> Monty Taylor <mord...@inaugust.com> Noam <noamk...@gmail.com> +Pascal Corpet <pas...@bayesimpact.org> Rick van de Loo <rickvande...@gmail.com> Ryan Brooke Payne <ryan.pa...@daveramsey.com> Sebastian Kalinowski <sebast...@kalinowski.eu> @@ -24,6 +29,7 @@ Ville Skytt?? <ville.sky...@iki.fi> boncheff <bonch...@users.noreply.github.com> clslgrnc <clslg...@users.noreply.github.com> +dongfangtianyu <7629022+dongfangtia...@users.noreply.github.com> popokatapepel <jan-se...@hotmail.de> reedip <reedip.baner...@nectechnologies.in> rfportilla <rfporti...@yahoo.com> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/requests-mock-1.8.0/ChangeLog new/requests-mock-1.9.2/ChangeLog --- old/requests-mock-1.8.0/ChangeLog 2020-05-02 15:10:52.000000000 +0200 +++ new/requests-mock-1.9.2/ChangeLog 2021-04-30 05:36:44.000000000 +0200 @@ -1,6 +1,38 @@ CHANGES ======= +1.9.2 +----- + +* Add release note for urlquote fix +* Simple tests to ensure character encoding works +* Use requests to quote URLs +* Remove circleci badge from README + +1.9.1 +----- + +* Restore py.typed file to enable types + +1.9.0 +----- + +* Change tag pattern +* Url Quote the path provided to the mocker +* Use github action to push a release to PyPI (#163) +* Release note for type hints +* Add [PEP 484](https://www.python.org/dev/peps/pep-0484/) type hints +* Mocker.copy: Use correct type when copying mocker +* Run unit tests for pull requests as well +* Add support for Python up to 3.9 +* Use Github Actions +* Make is\_bound\_method private +* Add release note for fixed bug +* Correctly handle an explicit zero byte read +* Add missing string delimiter in example +* fix: is\_bound\_method by six +* fix: \`session\` and \`real\_http\` cannot be used at the same time + 1.8.0 ----- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/requests-mock-1.8.0/PKG-INFO new/requests-mock-1.9.2/PKG-INFO --- old/requests-mock-1.8.0/PKG-INFO 2020-05-02 15:10:53.000000000 +0200 +++ new/requests-mock-1.9.2/PKG-INFO 2021-04-30 05:36:45.078632800 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: requests-mock -Version: 1.8.0 +Version: 1.9.2 Summary: Mock out responses from the requests package Home-page: https://requests-mock.readthedocs.io/ Author: Jamie Lennox @@ -13,9 +13,6 @@ .. image:: https://badge.fury.io/py/requests-mock.png :target: https://pypi.org/project/requests-mock/ - .. image:: https://circleci.com/gh/jamielennox/requests-mock.svg?style=svg - :target: https://circleci.com/gh/jamielennox/requests-mock - Intro ===== @@ -126,6 +123,8 @@ Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: 3.9 Classifier: Programming Language :: Python :: Implementation :: CPython Classifier: Programming Language :: Python :: Implementation :: PyPy Classifier: Topic :: Software Development :: Testing diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/requests-mock-1.8.0/README.rst new/requests-mock-1.9.2/README.rst --- old/requests-mock-1.8.0/README.rst 2020-05-02 15:10:34.000000000 +0200 +++ new/requests-mock-1.9.2/README.rst 2021-04-30 05:36:39.000000000 +0200 @@ -5,9 +5,6 @@ .. image:: https://badge.fury.io/py/requests-mock.png :target: https://pypi.org/project/requests-mock/ -.. image:: https://circleci.com/gh/jamielennox/requests-mock.svg?style=svg - :target: https://circleci.com/gh/jamielennox/requests-mock - Intro ===== diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/requests-mock-1.8.0/RELEASENOTES.rst new/requests-mock-1.9.2/RELEASENOTES.rst --- old/requests-mock-1.8.0/RELEASENOTES.rst 2020-05-02 15:10:53.000000000 +0200 +++ new/requests-mock-1.9.2/RELEASENOTES.rst 2021-04-30 05:36:45.000000000 +0200 @@ -2,6 +2,65 @@ requests-mock ============= +.. _requests-mock_1.9.2: + +1.9.2 +===== + +.. _requests-mock_1.9.2_Bug Fixes: + +Bug Fixes +--------- + +.. releasenotes/notes/Fix-urlquote-of-quoted-path-84cc1ff122dba279.yaml @ b'77f1a1fef7a6bb60b1ad4bafb85159782474178d' + +- As part of 1.9.0 we started quoting unsafe URL characters. This was done incorrectly that meant we requoted existing quoted strings. Fixes + + +.. _requests-mock_1.9.1: + +1.9.1 +===== + +.. _requests-mock_1.9.1_Bug Fixes: + +Bug Fixes +--------- + +.. releasenotes/notes/Add-py.typed-file-5a5cae1041dd0859.yaml @ b'78ef2d0a377355d5e0a20e6eeb6c8333f3bdf17c' + +- A py.typed file is required to enable type annotations for the package. Add to pack for re-release. + + +.. _requests-mock_1.9.0: + +1.9.0 +===== + +.. _requests-mock_1.9.0_New Features: + +New Features +------------ + +.. releasenotes/notes/Support-Type-Hints-0f7d2385bd808d84.yaml @ b'402fd627cc28f76f6938c17848c6c88ff58863c0' + +- Add python type hints for python 3. + + +.. _requests-mock_1.9.0_Bug Fixes: + +Bug Fixes +--------- + +.. releasenotes/notes/fix-zero-bytes-read-109628b72221cfe7.yaml @ b'91bb753d62c8788d0ed72292d5e1f37ed1a365e0' + +- Issue 144 - When performing a read we handled an empty byte return as an indication to close the file pointer. This is not true when you actually ask for a zero byte read so we should allow it. + +.. releasenotes/notes/url-quote-path-a593190dee974a7a.yaml @ b'f072845c0cb13c6c0fb18824160639a8bb3c7fe8' + +- Fix [#148](https://github.com/jamielennox/requests-mock/issues/158). When you have a non url-safe character in your URL it is quoted by requests however requests-mock just treated it as a normal string. + + .. _requests-mock_1.8.0: 1.8.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/requests-mock-1.8.0/doc/source/history.rst new/requests-mock-1.9.2/doc/source/history.rst --- old/requests-mock-1.8.0/doc/source/history.rst 2020-05-02 15:10:34.000000000 +0200 +++ new/requests-mock-1.9.2/doc/source/history.rst 2021-04-30 05:36:39.000000000 +0200 @@ -15,7 +15,7 @@ >>> import requests_mock >>> with requests_mock.mock() as m: - ... m.get('http://test.com, text='resp') + ... m.get('http://test.com', text='resp') ... resp = requests.get('http://test.com') ... >>> m.called diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/requests-mock-1.8.0/oldest-requirements.txt new/requests-mock-1.9.2/oldest-requirements.txt --- old/requests-mock-1.8.0/oldest-requirements.txt 1970-01-01 01:00:00.000000000 +0100 +++ new/requests-mock-1.9.2/oldest-requirements.txt 2021-04-30 05:36:39.000000000 +0200 @@ -0,0 +1 @@ +requests==2.0.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/requests-mock-1.8.0/releasenotes/notes/Add-py.typed-file-5a5cae1041dd0859.yaml new/requests-mock-1.9.2/releasenotes/notes/Add-py.typed-file-5a5cae1041dd0859.yaml --- old/requests-mock-1.8.0/releasenotes/notes/Add-py.typed-file-5a5cae1041dd0859.yaml 1970-01-01 01:00:00.000000000 +0100 +++ new/requests-mock-1.9.2/releasenotes/notes/Add-py.typed-file-5a5cae1041dd0859.yaml 2021-04-30 05:36:39.000000000 +0200 @@ -0,0 +1,3 @@ +--- +fixes: + - A py.typed file is required to enable type annotations for the package. Add to pack for re-release. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/requests-mock-1.8.0/releasenotes/notes/Fix-urlquote-of-quoted-path-84cc1ff122dba279.yaml new/requests-mock-1.9.2/releasenotes/notes/Fix-urlquote-of-quoted-path-84cc1ff122dba279.yaml --- old/requests-mock-1.8.0/releasenotes/notes/Fix-urlquote-of-quoted-path-84cc1ff122dba279.yaml 1970-01-01 01:00:00.000000000 +0100 +++ new/requests-mock-1.9.2/releasenotes/notes/Fix-urlquote-of-quoted-path-84cc1ff122dba279.yaml 2021-04-30 05:36:39.000000000 +0200 @@ -0,0 +1,3 @@ +--- +fixes: + - As part of 1.9.0 we started quoting unsafe URL characters. This was done incorrectly that meant we requoted existing quoted strings. Fixes #170. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/requests-mock-1.8.0/releasenotes/notes/Support-Type-Hints-0f7d2385bd808d84.yaml new/requests-mock-1.9.2/releasenotes/notes/Support-Type-Hints-0f7d2385bd808d84.yaml --- old/requests-mock-1.8.0/releasenotes/notes/Support-Type-Hints-0f7d2385bd808d84.yaml 1970-01-01 01:00:00.000000000 +0100 +++ new/requests-mock-1.9.2/releasenotes/notes/Support-Type-Hints-0f7d2385bd808d84.yaml 2021-04-30 05:36:39.000000000 +0200 @@ -0,0 +1,3 @@ +--- +features: + - Add python type hints for python 3. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/requests-mock-1.8.0/releasenotes/notes/fix-zero-bytes-read-109628b72221cfe7.yaml new/requests-mock-1.9.2/releasenotes/notes/fix-zero-bytes-read-109628b72221cfe7.yaml --- old/requests-mock-1.8.0/releasenotes/notes/fix-zero-bytes-read-109628b72221cfe7.yaml 1970-01-01 01:00:00.000000000 +0100 +++ new/requests-mock-1.9.2/releasenotes/notes/fix-zero-bytes-read-109628b72221cfe7.yaml 2021-04-30 05:36:39.000000000 +0200 @@ -0,0 +1,5 @@ +--- +fixes: + - Issue 144 - When performing a read we handled an empty byte return as an + indication to close the file pointer. This is not true when you actually + ask for a zero byte read so we should allow it. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/requests-mock-1.8.0/releasenotes/notes/reno.cache new/requests-mock-1.9.2/releasenotes/notes/reno.cache --- old/requests-mock-1.8.0/releasenotes/notes/reno.cache 2020-05-02 15:10:53.000000000 +0200 +++ new/requests-mock-1.9.2/releasenotes/notes/reno.cache 2021-04-30 05:36:44.000000000 +0200 @@ -1,4 +1,49 @@ --- +dates: +- date: 1512515002 + version: 1.4.0 +- date: 1619753746 + version: 1.9.2 +- date: 1403529047 + version: 0.2.0 +- date: 1404197047 + version: 0.3.0 +- date: 1619603915 + version: 1.9.1 +- date: 1480900960 + version: 1.2.0 +- date: 1409211257 + version: 0.5.1 +- date: 1408949673 + version: 0.5.0 +- date: 1588424388 + version: 1.8.0 +- date: 1473836597 + version: 1.1.0 +- date: 1532135081 + version: 1.5.1 +- date: 1402924380 + version: 0.1.0 +- date: 1462770653 + version: 1.0.0 +- date: 1448328589 + version: 0.7.0 +- date: 1485927403 + version: 1.3.0 +- date: 1421641725 + version: 0.6.0 +- date: 1404273975 + version: 0.4.0 +- date: 1619591865 + version: 1.9.0 +- date: 1525990894 + version: 1.5.0 +- date: 1556442539 + version: 1.6.0 +- date: 1532145389 + version: 1.5.2 +- date: 1567324008 + version: 1.7.0 file-contents: releasenotes/notes/Add-called_once-property-a69546448cbd5542.yaml: features: @@ -7,6 +52,10 @@ prelude: 'Add a called_once property to the mockers. ' + releasenotes/notes/Add-py.typed-file-5a5cae1041dd0859.yaml: + fixes: + - A py.typed file is required to enable type annotations for the package. Add + to pack for re-release. releasenotes/notes/Allow-pickling-response-fe751b0a760a5001.yaml: fixes: - Remove weakref objects from the request/response that will allow the objects @@ -27,6 +76,13 @@ prelude: 'Increase the minimum required requests version to 2.3 ' + releasenotes/notes/Fix-urlquote-of-quoted-path-84cc1ff122dba279.yaml: + fixes: + - As part of 1.9.0 we started quoting unsafe URL characters. This was done incorrectly + that meant we requoted existing quoted strings. Fixes + releasenotes/notes/Support-Type-Hints-0f7d2385bd808d84.yaml: + features: + - Add python type hints for python 3. releasenotes/notes/add-reset-function-bcef01162cab0912.yaml: features: - 'Add a reset/reset_mock function to the mocker and components so that users @@ -89,6 +145,11 @@ - Fixed a bug relating to how the pytest version was being discovered that meant new versions of pytest were being treated as old versions and would receive bad configuration. + releasenotes/notes/fix-zero-bytes-read-109628b72221cfe7.yaml: + fixes: + - Issue 144 - When performing a read we handled an empty byte return as an indication + to close the file pointer. This is not true when you actually ask for a zero + byte read so we should allow it. releasenotes/notes/fixture-extras-699a5b5fb5bd6aab.yaml: features: Added 'fixture' to pip extras so you can install the fixture requirements with `pip install requests-mock[fixture]` @@ -165,6 +226,11 @@ __init__ time options. ' + releasenotes/notes/url-quote-path-a593190dee974a7a.yaml: + fixes: + - Fix [#148](https://github.com/jamielennox/requests-mock/issues/158). When you + have a non url-safe character in your URL it is quoted by requests however requests-mock + just treated it as a normal string. releasenotes/notes/user-response-encoding-b2eea39404140164.yaml: fixes: - 'If you specified a charset in the Content-Type of a response it would be @@ -178,6 +244,27 @@ ' notes: - files: + - - releasenotes/notes/Fix-urlquote-of-quoted-path-84cc1ff122dba279.yaml + - !!binary | + NzdmMWExZmVmN2E2YmI2MGIxYWQ0YmFmYjg1MTU5NzgyNDc0MTc4ZA== + version: 1.9.2 +- files: + - - releasenotes/notes/Add-py.typed-file-5a5cae1041dd0859.yaml + - !!binary | + NzhlZjJkMGEzNzczNTVkNWUwYTIwZTZlZWI2YzgzMzNmM2JkZjE3Yw== + version: 1.9.1 +- files: + - - releasenotes/notes/Support-Type-Hints-0f7d2385bd808d84.yaml + - !!binary | + NDAyZmQ2MjdjYzI4Zjc2ZjY5MzhjMTc4NDhjNmM4OGZmNTg4NjNjMA== + - - releasenotes/notes/fix-zero-bytes-read-109628b72221cfe7.yaml + - !!binary | + OTFiYjc1M2Q2MmM4Nzg4ZDBlZDcyMjkyZDVlMWYzN2VkMWEzNjVlMA== + - - releasenotes/notes/url-quote-path-a593190dee974a7a.yaml + - !!binary | + ZjA3Mjg0NWMwY2IxM2M2YzBmYjE4ODI0MTYwNjM5YThiYjNjN2ZlOA== + version: 1.9.0 +- files: - - releasenotes/notes/add-reset-function-bcef01162cab0912.yaml - !!binary | YWVjYTczYWViNTc3NTIzMTVhNWI2Y2QxMjNiMDBhMjRlODFmOGMzOQ== diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/requests-mock-1.8.0/releasenotes/notes/url-quote-path-a593190dee974a7a.yaml new/requests-mock-1.9.2/releasenotes/notes/url-quote-path-a593190dee974a7a.yaml --- old/requests-mock-1.8.0/releasenotes/notes/url-quote-path-a593190dee974a7a.yaml 1970-01-01 01:00:00.000000000 +0100 +++ new/requests-mock-1.9.2/releasenotes/notes/url-quote-path-a593190dee974a7a.yaml 2021-04-30 05:36:39.000000000 +0200 @@ -0,0 +1,5 @@ +--- +fixes: + - Fix [#148](https://github.com/jamielennox/requests-mock/issues/158). When + you have a non url-safe character in your URL it is quoted by requests + however requests-mock just treated it as a normal string. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/requests-mock-1.8.0/requests_mock/__init__.pyi new/requests-mock-1.9.2/requests_mock/__init__.pyi --- old/requests-mock-1.8.0/requests_mock/__init__.pyi 1970-01-01 01:00:00.000000000 +0100 +++ new/requests-mock-1.9.2/requests_mock/__init__.pyi 2021-04-30 05:36:39.000000000 +0200 @@ -0,0 +1,7 @@ +# Stubs for requests_mock + +from requests_mock.adapter import ANY as ANY, Adapter as Adapter +from requests_mock.exceptions import MockException as MockException, NoMockAddress as NoMockAddress +from requests_mock.mocker import DELETE as DELETE, GET as GET, HEAD as HEAD, Mocker as Mocker, MockerCore as MockerCore, OPTIONS as OPTIONS, PATCH as PATCH, POST as POST, PUT as PUT, mock as mock +from requests_mock.request import _RequestObjectProxy as _RequestObjectProxy +from requests_mock.response import CookieJar as CookieJar, create_response as create_response diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/requests-mock-1.8.0/requests_mock/adapter.py new/requests-mock-1.9.2/requests_mock/adapter.py --- old/requests-mock-1.8.0/requests_mock/adapter.py 2020-05-02 15:10:34.000000000 +0200 +++ new/requests-mock-1.9.2/requests_mock/adapter.py 2021-04-30 05:36:39.000000000 +0200 @@ -13,6 +13,7 @@ import weakref from requests.adapters import BaseAdapter +from requests.utils import requote_uri import six from six.moves.urllib import parse as urlparse @@ -102,7 +103,7 @@ url_parts = urlparse.urlparse(url) self._scheme = url_parts.scheme.lower() self._netloc = url_parts.netloc.lower() - self._path = url_parts.path or '/' + self._path = requote_uri(url_parts.path or '/') self._query = url_parts.query if not case_sensitive: @@ -252,7 +253,9 @@ if resp is not None: request._matcher = weakref.ref(matcher) resp.connection = self - logger.debug('{} {} {}'.format(request._request.method,request._request.url, resp.status_code)) + logger.debug('{} {} {}'.format(request._request.method, + request._request.url, + resp.status_code)) return resp raise exceptions.NoMockAddress(request) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/requests-mock-1.8.0/requests_mock/adapter.pyi new/requests-mock-1.9.2/requests_mock/adapter.pyi --- old/requests-mock-1.8.0/requests_mock/adapter.pyi 1970-01-01 01:00:00.000000000 +0100 +++ new/requests-mock-1.9.2/requests_mock/adapter.pyi 2021-04-30 05:36:39.000000000 +0200 @@ -0,0 +1,30 @@ +# Stubs for requests_mock.adapter + +from requests.adapters import BaseAdapter +from requests_mock import _RequestObjectProxy +from typing import Any, List, Optional + +ANY: object = ... + +class _RequestHistoryTracker: + request_history: List[_RequestObjectProxy] = ... + def __init__(self) -> None: ... + @property + def last_request(self) -> Optional[_RequestObjectProxy]: ... + @property + def called(self) -> bool: ... + @property + def called_once(self) -> bool: ... + @property + def call_count(self) -> int: ... + +class _RunRealHTTP(Exception): ... + +class _Matcher(_RequestHistoryTracker): + def __init__(self, method: Any, url: Any, responses: Any, complete_qs: Any, request_headers: Any, additional_matcher: Any, real_http: Any, case_sensitive: Any) -> None: ... + def __call__(self, request: Any) -> Any: ... + +class Adapter(BaseAdapter, _RequestHistoryTracker): + def __init__(self, case_sensitive: bool = ...) -> None: ... + def register_uri(self, method: Any, url: Any, response_list: Optional[Any] = ..., **kwargs: Any) -> Any: ... + def add_matcher(self, matcher: Any) -> None: ... diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/requests-mock-1.8.0/requests_mock/compat.py new/requests-mock-1.9.2/requests_mock/compat.py --- old/requests-mock-1.8.0/requests_mock/compat.py 2020-05-02 15:10:34.000000000 +0200 +++ new/requests-mock-1.9.2/requests_mock/compat.py 2021-04-30 05:36:39.000000000 +0200 @@ -10,8 +10,6 @@ # License for the specific language governing permissions and limitations # under the License. -import requests - class _FakeHTTPMessage(object): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/requests-mock-1.8.0/requests_mock/exceptions.pyi new/requests-mock-1.9.2/requests_mock/exceptions.pyi --- old/requests-mock-1.8.0/requests_mock/exceptions.pyi 1970-01-01 01:00:00.000000000 +0100 +++ new/requests-mock-1.9.2/requests_mock/exceptions.pyi 2021-04-30 05:36:39.000000000 +0200 @@ -0,0 +1,11 @@ +# Stubs for requests_mock.exceptions + +from typing import Any + +class MockException(Exception): ... + +class NoMockAddress(MockException): + request: Any = ... + def __init__(self, request: Any) -> None: ... + +class InvalidRequest(MockException): ... diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/requests-mock-1.8.0/requests_mock/mocker.py new/requests-mock-1.9.2/requests_mock/mocker.py --- old/requests-mock-1.8.0/requests_mock/mocker.py 2020-05-02 15:10:34.000000000 +0200 +++ new/requests-mock-1.9.2/requests_mock/mocker.py 2021-04-30 05:36:39.000000000 +0200 @@ -11,6 +11,7 @@ # under the License. import functools +import types import requests import six @@ -29,13 +30,25 @@ _original_send = requests.Session.send +def _is_bound_method(method): + """ + bound_method 's self is a obj + unbound_method 's self is None + """ + if isinstance(method, types.MethodType) and six.get_method_self(method): + return True + return False + + def _set_method(target, name, method): """ Set a mocked method onto the target. Target may be either an instance of a Session object of the requests.Session class. First we Bind the method if it's an instance. + + If method is a bound_method, can direct setattr """ - if not isinstance(target, type): + if not isinstance(target, type) and not _is_bound_method(method): method = six.create_bound_method(method, target) setattr(target, name, method) @@ -238,7 +251,7 @@ def copy(self): """Returns an exact copy of current mock """ - m = Mocker( + m = type(self)( kw=self._kw, real_http=self.real_http, case_sensitive=self.case_sensitive diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/requests-mock-1.8.0/requests_mock/mocker.pyi new/requests-mock-1.9.2/requests_mock/mocker.pyi --- old/requests-mock-1.8.0/requests_mock/mocker.pyi 1970-01-01 01:00:00.000000000 +0100 +++ new/requests-mock-1.9.2/requests_mock/mocker.pyi 2021-04-30 05:36:39.000000000 +0200 @@ -0,0 +1,120 @@ +# Stubs for requests_mock.mocker + +from requests import Response +from requests_mock.request import _RequestObjectProxy +from typing import Any, Callable, Dict, List, Optional, Pattern, Type, TypeVar, Union + +DELETE: str +GET: str +HEAD: str +OPTIONS: str +PATCH: str +POST: str +PUT: str + +class MockerCore: + case_sensitive: bool = ... + def __init__(self, **kwargs: Any) -> None: ... + def start(self) -> None: ... + def stop(self) -> None: ... + def add_matcher(self, matcher: Any) -> None: ... + @property + def request_history(self) -> List[_RequestObjectProxy]: ... + @property + def last_request(self) -> Optional[_RequestObjectProxy]: ... + @property + def called(self) -> bool: ... + @property + def called_once(self) -> bool: ... + @property + def call_count(self) -> int: ... + def register_uri( + self, + method: str, + status_code: int = ..., + text: str = ..., + headers: Optional[Dict[str, str]] = ..., + additional_matcher: Optional[Callable[[_RequestObjectProxy], bool]] = ..., + **kwargs: Any) -> Response: ... + def request( + self, + method: str, + status_code: int = ..., + text: str = ..., + headers: Optional[Dict[str, str]] = ..., + additional_matcher: Optional[Callable[[_RequestObjectProxy], bool]] = ..., + **kwargs: Any) -> Response: ... + def get( + self, + path: Union[str, Pattern[str]], + status_code: int = ..., + text: str = ..., + headers: Optional[Dict[str, str]] = ..., + additional_matcher: Optional[Callable[[_RequestObjectProxy], bool]] = ..., + **kwargs: Any) -> Response: ... + def head( + self, + path: Union[str, Pattern[str]], + status_code: int = ..., + text: str = ..., + headers: Optional[Dict[str, str]] = ..., + additional_matcher: Optional[Callable[[_RequestObjectProxy], bool]] = ..., + **kwargs: Any) -> Response: ... + def options( + self, + path: Union[str, Pattern[str]], + status_code: int = ..., + text: str = ..., + headers: Optional[Dict[str, str]] = ..., + additional_matcher: Optional[Callable[[_RequestObjectProxy], bool]] = ..., + **kwargs: Any) -> Response: ... + def post( + self, + path: Union[str, Pattern[str]], + status_code: int = ..., + text: str = ..., + headers: Optional[Dict[str, str]] = ..., + additional_matcher: Optional[Callable[[_RequestObjectProxy], bool]] = ..., + **kwargs: Any) -> Response: ... + def put( + self, + path: Union[str, Pattern[str]], + status_code: int = ..., + text: str = ..., + headers: Optional[Dict[str, str]] = ..., + additional_matcher: Optional[Callable[[_RequestObjectProxy], bool]] = ..., + **kwargs: Any) -> Response: ... + def patch( + self, + path: Union[str, Pattern[str]], + status_code: int = ..., + text: str = ..., + headers: Optional[Dict[str, str]] = ..., + additional_matcher: Optional[Callable[[_RequestObjectProxy], bool]] = ..., + **kwargs: Any) -> Response: ... + def delete( + self, + path: Union[str, Pattern[str]], + status_code: int = ..., + text: str = ..., + headers: Optional[Dict[str, str]] = ..., + additional_matcher: Optional[Callable[[_RequestObjectProxy], bool]] = ..., + **kwargs: Any) -> Response: ... + +_T = TypeVar('_T') + +class Mocker(MockerCore): + TEST_PREFIX: str = ... + def __init__( + self, + kw: str = ..., + case_sensitive: bool = ..., + adapter: Any = ..., + real_http: bool = ...) -> None: ... + def __enter__(self) -> Any: ... + def __exit__(self, type: Any, value: Any, traceback: Any) -> None: ... + def __call__(self, obj: Any) -> Any: ... + def copy(self) -> Mocker: ... + def decorate_callable(self, func: Callable[..., _T]) -> Callable[..., _T]: ... + def decorate_class(self, klass: Type[_T]) -> Type[_T]: ... +mock = Mocker diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/requests-mock-1.8.0/requests_mock/request.pyi new/requests-mock-1.9.2/requests_mock/request.pyi --- old/requests-mock-1.8.0/requests_mock/request.pyi 1970-01-01 01:00:00.000000000 +0100 +++ new/requests-mock-1.9.2/requests_mock/request.pyi 2021-04-30 05:36:39.000000000 +0200 @@ -0,0 +1,38 @@ +# Stubs for requests_mock.request + +from typing import Any, Dict, List + +class _RequestObjectProxy: + def __init__(self, request: Any, **kwargs: Any) -> None: ... + def __getattr__(self, name: str) -> Any: ... + @property + def scheme(self) -> str: ... + @property + def netloc(self) -> str: ... + @property + def hostname(self) -> str: ... + @property + def port(self) -> int: ... + @property + def path(self) -> str: ... + @property + def query(self) -> str: ... + @property + def qs(self) -> Dict[str, List[str]]: ... + @property + def timeout(self) -> int: ... + @property + def allow_redirects(self) -> bool: ... + @property + def verify(self) -> Any: ... + @property + def stream(self) -> Any: ... + @property + def cert(self) -> Any: ... + @property + def proxies(self) -> Any: ... + @property + def text(self) -> str: ... + def json(self, **kwargs: Any) -> Any: ... + @property + def matcher(self) -> Any: ... diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/requests-mock-1.8.0/requests_mock/response.py new/requests-mock-1.9.2/requests_mock/response.py --- old/requests-mock-1.8.0/requests_mock/response.py 2020-05-02 15:10:34.000000000 +0200 +++ new/requests-mock-1.9.2/requests_mock/response.py 2021-04-30 05:36:39.000000000 +0200 @@ -116,6 +116,11 @@ if self.closed: return six.b('') + # if the file is open, but you asked for zero bytes read you should get + # back zero without closing the stream. + if len(args) > 0 and args[0] == 0: + return six.b('') + # not a new style object in python 2 result = six.BytesIO.read(self, *args, **kwargs) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/requests-mock-1.8.0/requests_mock/response.pyi new/requests-mock-1.9.2/requests_mock/response.pyi --- old/requests-mock-1.8.0/requests_mock/response.pyi 1970-01-01 01:00:00.000000000 +0100 +++ new/requests-mock-1.9.2/requests_mock/response.pyi 2021-04-30 05:36:39.000000000 +0200 @@ -0,0 +1,28 @@ +# Stubs for requests_mock.response + +import six +from requests.cookies import RequestsCookieJar +from typing import Any + +class CookieJar(RequestsCookieJar): + def set(self, name: Any, value: Any, **kwargs: Any) -> Any: ... + +class _FakeConnection: + def send(self, request: Any, **kwargs: Any) -> None: ... + def close(self) -> None: ... + +class _IOReader(six.BytesIO): + def read(self, *args: Any, **kwargs: Any) -> Any: ... + +def create_response(request: Any, **kwargs: Any) -> Any: ... + +class _Context: + headers: Any = ... + status_code: Any = ... + reason: Any = ... + cookies: Any = ... + def __init__(self, headers: Any, status_code: Any, reason: Any, cookies: Any) -> None: ... + +class _MatcherResponse: + def __init__(self, **kwargs: Any) -> None: ... + def get_response(self, request: Any) -> Any: ... diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/requests-mock-1.8.0/requests_mock.egg-info/PKG-INFO new/requests-mock-1.9.2/requests_mock.egg-info/PKG-INFO --- old/requests-mock-1.8.0/requests_mock.egg-info/PKG-INFO 2020-05-02 15:10:52.000000000 +0200 +++ new/requests-mock-1.9.2/requests_mock.egg-info/PKG-INFO 2021-04-30 05:36:44.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: requests-mock -Version: 1.8.0 +Version: 1.9.2 Summary: Mock out responses from the requests package Home-page: https://requests-mock.readthedocs.io/ Author: Jamie Lennox @@ -13,9 +13,6 @@ .. image:: https://badge.fury.io/py/requests-mock.png :target: https://pypi.org/project/requests-mock/ - .. image:: https://circleci.com/gh/jamielennox/requests-mock.svg?style=svg - :target: https://circleci.com/gh/jamielennox/requests-mock - Intro ===== @@ -126,6 +123,8 @@ Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: 3.9 Classifier: Programming Language :: Python :: Implementation :: CPython Classifier: Programming Language :: Python :: Implementation :: PyPy Classifier: Topic :: Software Development :: Testing diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/requests-mock-1.8.0/requests_mock.egg-info/SOURCES.txt new/requests-mock-1.9.2/requests_mock.egg-info/SOURCES.txt --- old/requests-mock-1.8.0/requests_mock.egg-info/SOURCES.txt 2020-05-02 15:10:53.000000000 +0200 +++ new/requests-mock-1.9.2/requests_mock.egg-info/SOURCES.txt 2021-04-30 05:36:44.000000000 +0200 @@ -1,19 +1,21 @@ .coveragerc .testr.conf -.tox.oldest.txt AUTHORS ChangeLog LICENSE MANIFEST.in README.rst dev-requirements.txt +oldest-requirements.txt requirements.txt rtfd-requirements.txt setup.cfg setup.py test-requirements.txt tox.ini -.circleci/config.yml +.github/workflows/flake8.yaml +.github/workflows/release.yaml +.github/workflows/unit-test.yaml doc/Makefile doc/make.bat doc/api/modules.rst @@ -33,14 +35,18 @@ doc/source/release-notes.rst doc/source/response.rst releasenotes/notes/Add-called_once-property-a69546448cbd5542.yaml +releasenotes/notes/Add-py.typed-file-5a5cae1041dd0859.yaml releasenotes/notes/Allow-pickling-response-fe751b0a760a5001.yaml releasenotes/notes/Bump-minimum-requests-2.3-70fd287f6ea1a12e.yaml +releasenotes/notes/Fix-urlquote-of-quoted-path-84cc1ff122dba279.yaml +releasenotes/notes/Support-Type-Hints-0f7d2385bd808d84.yaml releasenotes/notes/add-reset-function-bcef01162cab0912.yaml releasenotes/notes/additional-matcher-5c5cd466a6d70080.yaml releasenotes/notes/case-insensitive-matching-a3143221359bbf2d.yaml releasenotes/notes/explicit-nesting-behaviour-4d28c310dc4c463a.yaml releasenotes/notes/fix-iter-content-none-1e29754a75273b8c.yaml releasenotes/notes/fix-pytest-version-discovery-43f27e7e162ed055.yaml +releasenotes/notes/fix-zero-bytes-read-109628b72221cfe7.yaml releasenotes/notes/fixture-extras-699a5b5fb5bd6aab.yaml releasenotes/notes/match-empty-query-string-e6d6976fe002da0b.yaml releasenotes/notes/pin-requests-version-e0f090aa31dc86c3.yaml @@ -51,14 +57,22 @@ releasenotes/notes/session-scoped-mock-7f1c98d9a91bffc8.yaml releasenotes/notes/set-default-response-reason-f24556261bc7e9e5.yaml releasenotes/notes/set-real-http-on-mocker-01eb26b65697466d.yaml +releasenotes/notes/url-quote-path-a593190dee974a7a.yaml releasenotes/notes/user-response-encoding-b2eea39404140164.yaml requests_mock/__init__.py +requests_mock/__init__.pyi requests_mock/adapter.py +requests_mock/adapter.pyi requests_mock/compat.py requests_mock/exceptions.py +requests_mock/exceptions.pyi requests_mock/mocker.py +requests_mock/mocker.pyi +requests_mock/py.typed requests_mock/request.py +requests_mock/request.pyi requests_mock/response.py +requests_mock/response.pyi requests_mock.egg-info/PKG-INFO requests_mock.egg-info/SOURCES.txt requests_mock.egg-info/dependency_links.txt diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/requests-mock-1.8.0/requests_mock.egg-info/pbr.json new/requests-mock-1.9.2/requests_mock.egg-info/pbr.json --- old/requests-mock-1.8.0/requests_mock.egg-info/pbr.json 2020-05-02 15:10:52.000000000 +0200 +++ new/requests-mock-1.9.2/requests_mock.egg-info/pbr.json 2021-04-30 05:36:44.000000000 +0200 @@ -1 +1 @@ -{"git_version": "1b9a732", "is_release": false} \ No newline at end of file +{"git_version": "850671f", "is_release": false} \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/requests-mock-1.8.0/setup.cfg new/requests-mock-1.9.2/setup.cfg --- old/requests-mock-1.8.0/setup.cfg 2020-05-02 15:10:53.000000000 +0200 +++ new/requests-mock-1.9.2/setup.cfg 2021-04-30 05:36:45.078632800 +0200 @@ -21,6 +21,8 @@ Programming Language :: Python :: 3.5 Programming Language :: Python :: 3.6 Programming Language :: Python :: 3.7 + Programming Language :: Python :: 3.8 + Programming Language :: Python :: 3.9 Programming Language :: Python :: Implementation :: CPython Programming Language :: Python :: Implementation :: PyPy Topic :: Software Development :: Testing @@ -28,6 +30,7 @@ [files] packages = requests_mock +package-data = requests_mock = py.typed, *.pyi [build_sphinx] all_files = 1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/requests-mock-1.8.0/tests/pytest/test_with_pytest.py new/requests-mock-1.9.2/tests/pytest/test_with_pytest.py --- old/requests-mock-1.8.0/tests/pytest/test_with_pytest.py 2020-05-02 15:10:34.000000000 +0200 +++ new/requests-mock-1.9.2/tests/pytest/test_with_pytest.py 2021-04-30 05:36:39.000000000 +0200 @@ -15,39 +15,51 @@ def test_redirect_and_nesting(): - url_inner = "inner_mock://example.test/" - url_middle = "middle_mock://example.test/" - url_outer = "outer_mock://example.test/" - url = "https://www.example.com/" + url_inner = "inner-mock://example.test/" + url_middle = "middle-mock://example.test/" + url_outer = "outer-mock://example.test/" + url_base = "https://www.example.com/" + + text_middle = 'middle' + url_middle + text_outer = 'outer' + url_outer + text_base = 'outer' + url_base + with requests_mock.Mocker() as outer_mock: - outer_mock.get(url, text='outer' + url) - outer_mock.get(url_outer, text='outer' + url_outer) + outer_mock.get(url_base, text=text_base) + outer_mock.get(url_outer, text=text_outer) with requests_mock.Mocker(real_http=True) as middle_mock: - middle_mock.get(url_middle, text='middle' + url_middle) + middle_mock.get(url_middle, text=text_middle) with requests_mock.Mocker() as inner_mock: - inner_mock.post(url_inner, status_code=HTTP_STATUS_FOUND, headers={'location': url}) - inner_mock.get(url, real_http=True) + inner_mock.post(url_inner, + status_code=HTTP_STATUS_FOUND, + headers={'location': url_base}) + inner_mock.get(url_base, real_http=True) + + assert text_base == requests.post(url_inner).text # nosec - assert 'outer' + url == requests.post(url_inner).text # nosec with pytest.raises(requests_mock.NoMockAddress): requests.get(url_middle) + with pytest.raises(requests_mock.NoMockAddress): requests.get(url_outer) # back to middle mock with pytest.raises(requests_mock.NoMockAddress): requests.post(url_inner) - assert 'middle' + url_middle == requests.get(url_middle).text # nosec - assert 'outer' + url_outer == requests.get(url_outer).text # nosec + + assert text_middle == requests.get(url_middle).text # nosec + assert text_outer == requests.get(url_outer).text # nosec # back to outter mock with pytest.raises(requests_mock.NoMockAddress): requests.post(url_inner) + with pytest.raises(requests_mock.NoMockAddress): requests.get(url_middle) - assert 'outer' + url_outer == requests.get(url_outer).text # nosec + + assert text_outer == requests.get(url_outer).text # nosec def test_mixed_mocks(): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/requests-mock-1.8.0/tests/test_matcher.py new/requests-mock-1.9.2/tests/test_matcher.py --- old/requests-mock-1.8.0/tests/test_matcher.py 2020-05-02 15:10:34.000000000 +0200 +++ new/requests-mock-1.9.2/tests/test_matcher.py 2021-04-30 05:36:39.000000000 +0200 @@ -141,7 +141,6 @@ 'http://www.test.com/abc') self.assertMatchBoth('http://www.test.com:5000/abc', 'http://www.test.com:5000/abc') - self.assertNoMatchBoth('https://www.test.com', 'http://www.test.com') self.assertNoMatchBoth('http://www.test.com/abc', @@ -159,6 +158,14 @@ self.assertNoMatchBoth('http://test.com/abc/', 'http://www.test.com:5000/abc') + def test_quotation(self): + self.assertMatchBoth('http://www.test.com/a string%url', + 'http://www.test.com/a string%url') + self.assertMatchBoth('http://www.test.com/ABC 123', + 'http://www.test.com/ABC%20123') + self.assertMatchBoth('http://www.test.com/u...@example.com', + 'http://www.test.com/u...@example.com') + def test_subset_match(self): self.assertMatch('/path', 'http://www.test.com/path') self.assertMatch('/path', 'http://www.test.com/path') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/requests-mock-1.8.0/tests/test_mocker.py new/requests-mock-1.9.2/tests/test_mocker.py --- old/requests-mock-1.8.0/tests/test_mocker.py 2020-05-02 15:10:34.000000000 +0200 +++ new/requests-mock-1.9.2/tests/test_mocker.py 2021-04-30 05:36:39.000000000 +0200 @@ -61,7 +61,8 @@ session_a_original_send = session_a.send session_b_original_send = session_b.send - self.assertNotEqual(session_a_original_send, session_b_original_send) + self.assertNotEqual(session_a_original_send, + session_b_original_send) mocker_a = requests_mock.Mocker(session=session_a) mocker_b = requests_mock.Mocker(session=session_b) @@ -75,27 +76,29 @@ with requests_mock.Mocker(session=session_b) as mocker_b_inner: mocker_b_inner.register_uri('GET', url, real_http=True) - mocker_b_inner.register_uri('GET', url_inner, text='resp_b_inner') + mocker_b_inner.register_uri('GET', + url_inner, + text='resp_b_inner') self.assertEqual('resp_a', session_a.get(url).text) self.assertEqual('resp_b', session_b.get(url).text) self.assertRaises(exceptions.NoMockAddress, - session_a.get, - url_inner) + session_a.get, + url_inner) self.assertEqual('resp_b_inner', session_b.get(url_inner).text) self.assertEqual('resp_a', session_a.get(url).text) self.assertEqual('resp_b', session_b.get(url).text) self.assertRaises(exceptions.NoMockAddress, - session_a.get, - url_inner) + session_a.get, + url_inner) self.assertRaises(exceptions.NoMockAddress, - session_b.get, - url_inner) + session_b.get, + url_inner) self.assertEqual('global', session_a.get(url_outer).text) self.assertRaises(exceptions.NoMockAddress, - session_b.get, - url_outer) + session_b.get, + url_outer) self.assertNotEqual(session_a.send, session_a_original_send) self.assertNotEqual(session_b.send, session_b_original_send) @@ -106,8 +109,8 @@ self.assertEqual(session_a.send, session_a_original_send) self.assertEqual(session_b.send, session_b_original_send) - self.assertEqual(requests.Session.send, original_send) + self.assertEqual(requests.Session.send, original_send) def test_with_context_manager(self): self.assertMockStopped() @@ -170,6 +173,24 @@ self.assertEqual(test_text, resp.text) self.assertEqual(test_bytes, resp.content) + @mock.patch('requests.adapters.HTTPAdapter.send') + def test_real_http_and_session(self, real_send): + url = 'http://www.google.com/' + test_text = 'real http data' + test_bytes = test_text.encode('utf-8') + + req = requests.Request(method='GET', url=url) + real_send.return_value = response.create_response(req.prepare(), + status_code=200, + content=test_bytes) + + session = requests.Session() + with requests_mock.Mocker(session=session, real_http=True): + resp = session.get(url) + + self.assertEqual(test_text, resp.text) + self.assertEqual(test_bytes, resp.content) + @requests_mock.mock() def test_with_test_decorator(self, m): self._do_test(m) @@ -566,3 +587,16 @@ self.assertEqual(text, new_resp.text) self.assertIsInstance(orig_resp.request.matcher, adapter._Matcher) self.assertIsNone(new_resp.request.matcher) + + @requests_mock.mock() + def test_stream_zero_bytes(self, m): + content = b'blah' + + m.get("http://test", content=content) + res = requests.get("http://test", stream=True) + zero_val = res.raw.read(0) + self.assertEqual(b'', zero_val) + self.assertFalse(res.raw.closed) + + full_val = res.raw.read() + self.assertEqual(content, full_val) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/requests-mock-1.8.0/tox.ini new/requests-mock-1.9.2/tox.ini --- old/requests-mock-1.8.0/tox.ini 2020-05-02 15:10:34.000000000 +0200 +++ new/requests-mock-1.9.2/tox.ini 2021-04-30 05:36:39.000000000 +0200 @@ -1,5 +1,5 @@ [tox] -envlist = py37,py36,py35,py34,py27,pypy3,pypy,pep8 +envlist = py39,py38,py37,py36,py35,py34,py27,pypy3,pypy,pep8 [testenv] setenv =