From 9bdd22f6608376d141ac76f3a2ce33e8e1485de5 Mon Sep 17 00:00:00 2001 From: JinWang An Date: Thu, 10 Dec 2020 09:37:49 +0900 Subject: [PATCH] Imported Upstream version 3.0.4 --- .carthorse.yml | 1 - .circleci/config.yml | 72 ++++++++++++++++++++++++++++++++++++------------- CHANGELOG.rst | 11 +++++++- MANIFEST.in | 2 ++ docs/changelog.txt | 4 +-- docs/index.txt | 10 ++++--- mock/mock.py | 4 +-- mock/tests/testpatch.py | 8 ++++++ 8 files changed, 85 insertions(+), 27 deletions(-) create mode 100644 MANIFEST.in diff --git a/.carthorse.yml b/.carthorse.yml index 28e5563..d8f3a9a 100644 --- a/.carthorse.yml +++ b/.carthorse.yml @@ -5,6 +5,5 @@ carthorse: - version-not-tagged actions: - run: "sudo pip install -e .[build]" - - run: "sudo python setup.py sdist bdist_wheel" - run: "twine upload -u carthorse-mock -p $PYPI_PASS dist/*" - create-tag diff --git a/.circleci/config.yml b/.circleci/config.yml index 2febe1c..8416914 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,22 +1,25 @@ version: 2.1 orbs: - python: cjw296/python-ci@1.3 + python: cjw296/python-ci@2 jobs: - docs: + check-package: + parameters: + image: + type: string + python: + type: string + default: "python" docker: - - image: circleci/python:3.7 + - image: << parameters.image >> steps: - - checkout - - run: - name: "Install Project" - command: "sudo pip install -e .[docs]" - - run: - name: "Build Docs" - command: | - python setup.py build_sphinx - rst2html.py --strict README.rst README.html + - python/check-package: + package: "mock" + test: + - run: + name: "Import package" + command: << parameters.python >> -c "import mock" common: &common @@ -39,11 +42,9 @@ common: &common - python/pip-run-tests: name: pypy27 image: pypy:2.7 - sudo: false - python/pip-run-tests: name: pypy36 image: pypy:3.6 - sudo: false - python/coverage: name: coverage @@ -56,19 +57,54 @@ common: &common - pypy27 - pypy36 - - docs: + - python/pip-docs: + name: docs requires: - coverage - - python/release: - name: release - config: .carthorse.yml + - python/pip-setuptools-build-package: + name: package requires: - docs filters: branches: only: master + - check-package: + name: check-package-python27 + image: circleci/python:2.7 + requires: + - package + + - check-package: + name: check-package-python37 + image: circleci/python:3.7 + requires: + - package + + - check-package: + name: check-package-pypy27 + image: pypy:2.7 + python: pypy + requires: + - package + + - check-package: + name: check-package-pypy36 + image: pypy:3.6 + python: pypy3 + requires: + - package + + - python/release: + name: release + config: .carthorse.yml + requires: + - check-package-python27 + - check-package-python37 + - check-package-pypy27 + - check-package-pypy36 + workflows: push: <<: *common diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 575c975..f696a85 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,7 +1,16 @@ -3.0.2 +3.0.4 +----- + +- Include the license, readme and changelog in the source distribution. + +3.0.3 ----- +- Fixed patching of dictionaries, when specifying the target with a + unicode on Python 2. +3.0.2 +----- - Add missing ``funcsigs`` dependency on Python 2. diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..7f47ab6 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,2 @@ +include LICENSE.txt +include *.rst diff --git a/docs/changelog.txt b/docs/changelog.txt index 03e051e..4de03af 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -1,4 +1,4 @@ -Changelog from Python's News -============================ +Changelog +========= .. include:: ../CHANGELOG.rst diff --git a/docs/index.txt b/docs/index.txt index 68876e8..4e8bc17 100644 --- a/docs/index.txt +++ b/docs/index.txt @@ -59,8 +59,8 @@ with Mock functionality should be reported to the `Python bug tracker .. index:: python changes -Python Changes -++++++++++++++ +Changelog ++++++++++ See the :doc:`change log `. @@ -78,7 +78,11 @@ Committers can just push as desired: since all semantic development takes place in cPython, the backport process is as lightweight as we can make it. mock is CI tested using Travis-CI on Python versions 2.7, 3.4, -3.5, 3.6, nightly Python 3 builds, pypy, pypy3. +3.5, 3.6, pypy, pypy3. + +If you end up fixing anything backport-specific, please add an entry +to the top of ``CHANGELOG.rst`` so it shows up in the next release +notes. Releasing --------- diff --git a/mock/mock.py b/mock/mock.py index 7f3bafe..19cb4dd 100644 --- a/mock/mock.py +++ b/mock/mock.py @@ -68,7 +68,7 @@ from unittest.util import safe_repr import six from six import wraps -__version__ = '3.0.2' +__version__ = '3.0.4' version_info = tuple(int(p) for p in __version__.split('.')) import mock @@ -1768,7 +1768,7 @@ class _patch_dict(object): def _patch_dict(self): values = self.values - if isinstance(self.in_dict, str): + if isinstance(self.in_dict, basestring): self.in_dict = _importer(self.in_dict) in_dict = self.in_dict clear = self.clear diff --git a/mock/tests/testpatch.py b/mock/tests/testpatch.py index 958ea7f..bbd6d26 100644 --- a/mock/tests/testpatch.py +++ b/mock/tests/testpatch.py @@ -656,6 +656,14 @@ class PatchTest(unittest.TestCase): test() + def test_patch_dict_with_unicode(self): + @patch.dict(u'os.environ', {'konrad_delong': 'some value'}) + def test(): + self.assertIn('konrad_delong', os.environ) + + test() + + def test_patch_dict_decorator_resolution(self): # bpo-35512: Ensure that patch with a string target resolves to # the new dictionary during function call -- 2.7.4