Imported Upstream version 3.0.4 upstream/3.0.4
authorJinWang An <jinwang.an@samsung.com>
Thu, 10 Dec 2020 00:37:49 +0000 (09:37 +0900)
committerJinWang An <jinwang.an@samsung.com>
Thu, 10 Dec 2020 00:37:49 +0000 (09:37 +0900)
.carthorse.yml
.circleci/config.yml
CHANGELOG.rst
MANIFEST.in [new file with mode: 0644]
docs/changelog.txt
docs/index.txt
mock/mock.py
mock/tests/testpatch.py

index 28e5563..d8f3a9a 100644 (file)
@@ -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
index 2febe1c..8416914 100644 (file)
@@ -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
index 575c975..f696a85 100644 (file)
@@ -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 (file)
index 0000000..7f47ab6
--- /dev/null
@@ -0,0 +1,2 @@
+include LICENSE.txt
+include *.rst
index 03e051e..4de03af 100644 (file)
@@ -1,4 +1,4 @@
-Changelog from Python's News
-============================
+Changelog
+=========
 
 .. include:: ../CHANGELOG.rst
index 68876e8..4e8bc17 100644 (file)
@@ -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 <changelog>`.
 
@@ -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
 ---------
index 7f3bafe..19cb4dd 100644 (file)
@@ -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
index 958ea7f..bbd6d26 100644 (file)
@@ -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