[arch-commits] Commit in python-mock/repos/community-testing-any (3 files)

Eli Schwartz eschwartz at archlinux.org
Sun Aug 5 22:28:05 UTC 2018


    Date: Sunday, August 5, 2018 @ 22:28:04
  Author: eschwartz
Revision: 368431

archrelease: copy trunk to community-testing-any

Added:
  python-mock/repos/community-testing-any/0001-be-able-to-run-tests-on-python2.patch
    (from rev 368430, python-mock/trunk/0001-be-able-to-run-tests-on-python2.patch)
  python-mock/repos/community-testing-any/PKGBUILD
    (from rev 368430, python-mock/trunk/PKGBUILD)
Deleted:
  python-mock/repos/community-testing-any/PKGBUILD

--------------------------------------------+
 0001-be-able-to-run-tests-on-python2.patch |   92 +++++++++++++++++++++
 PKGBUILD                                   |  114 ++++++++++++++-------------
 2 files changed, 153 insertions(+), 53 deletions(-)

Copied: python-mock/repos/community-testing-any/0001-be-able-to-run-tests-on-python2.patch (from rev 368430, python-mock/trunk/0001-be-able-to-run-tests-on-python2.patch)
===================================================================
--- 0001-be-able-to-run-tests-on-python2.patch	                        (rev 0)
+++ 0001-be-able-to-run-tests-on-python2.patch	2018-08-05 22:28:04 UTC (rev 368431)
@@ -0,0 +1,92 @@
+From 2d7f6c41e9290ec42eae860582496f744cdc52bd Mon Sep 17 00:00:00 2001
+From: Eli Schwartz <eschwartz at archlinux.org>
+Date: Fri, 3 Aug 2018 11:13:47 -0400
+Subject: [PATCH] be able to run tests on python2
+
+use existing six dependency to access assertRaisesRegexp as assertRaisesRegex
+---
+ mock/tests/testmagicmethods.py |  2 +-
+ mock/tests/testmock.py         | 17 ++++++++++-------
+ 2 files changed, 11 insertions(+), 8 deletions(-)
+
+diff --git a/mock/tests/testmagicmethods.py b/mock/tests/testmagicmethods.py
+index f47a202..a6c280d 100644
+--- a/mock/tests/testmagicmethods.py
++++ b/mock/tests/testmagicmethods.py
+@@ -405,7 +405,7 @@ class TestMockingMagicMethods(unittest.TestCase):
+         mock = MagicMock()
+         def set_setattr():
+             mock.__setattr__ = lambda self, name: None
+-        self.assertRaisesRegex(AttributeError,
++        six.assertRaisesRegex(self, AttributeError,
+             "Attempting to set unsupported magic method '__setattr__'.",
+             set_setattr
+         )
+diff --git a/mock/tests/testmock.py b/mock/tests/testmock.py
+index 66323e9..e9c5fef 100644
+--- a/mock/tests/testmock.py
++++ b/mock/tests/testmock.py
+@@ -205,7 +205,7 @@ class MockTest(unittest.TestCase):
+ 
+         mock = create_autospec(f)
+         mock.side_effect = ValueError('Bazinga!')
+-        self.assertRaisesRegex(ValueError, 'Bazinga!', mock)
++        six.assertRaisesRegex(self, ValueError, 'Bazinga!', mock)
+ 
+     @unittest.skipUnless('java' in sys.platform,
+                           'This test only applies to Jython')
+@@ -501,7 +501,8 @@ class MockTest(unittest.TestCase):
+ 
+                 # this should be allowed
+                 mock.something
+-                self.assertRaisesRegex(
++                six.assertRaisesRegex(
++                    self,
+                     AttributeError,
+                     "Mock object has no attribute 'something_else'",
+                     getattr, mock, 'something_else'
+@@ -520,12 +521,14 @@ class MockTest(unittest.TestCase):
+             mock.x
+             mock.y
+             mock.__something__
+-            self.assertRaisesRegex(
++            six.assertRaisesRegex(
++                self,
+                 AttributeError,
+                 "Mock object has no attribute 'z'",
+                 getattr, mock, 'z'
+             )
+-            self.assertRaisesRegex(
++            six.assertRaisesRegex(
++                self,
+                 AttributeError,
+                 "Mock object has no attribute '__foobar__'",
+                 getattr, mock, '__foobar__'
+@@ -591,13 +594,13 @@ class MockTest(unittest.TestCase):
+ 
+     def test_assert_called_with_message(self):
+         mock = Mock()
+-        self.assertRaisesRegex(AssertionError, 'Not called',
++        six.assertRaisesRegex(self, AssertionError, 'Not called',
+                                 mock.assert_called_with)
+ 
+ 
+     def test_assert_called_once_with_message(self):
+         mock = Mock(name='geoffrey')
+-        self.assertRaisesRegex(AssertionError,
++        six.assertRaisesRegex(self, AssertionError,
+                      r"Expected 'geoffrey' to be called once\.",
+                      mock.assert_called_once_with)
+ 
+@@ -1486,7 +1489,7 @@ class MockTest(unittest.TestCase):
+         second = mopen().readline()
+         self.assertEqual('abc', first)
+         self.assertEqual('abc', second)
+- 
++
+     def test_mock_parents(self):
+         for Klass in Mock, MagicMock:
+             m = Klass()
+-- 
+2.18.0
+

Deleted: PKGBUILD
===================================================================
--- PKGBUILD	2018-08-05 22:27:46 UTC (rev 368430)
+++ PKGBUILD	2018-08-05 22:28:04 UTC (rev 368431)
@@ -1,53 +0,0 @@
-# $Id$
-# Maintainer: jelle van der Waa <jelle at vdwaa.nl>
-# Contributor: Felix Kaiser <felix.kaiser at fxkr.net>
-
-pkgbase=python-mock
-pkgname=(python2-mock python-mock)
-pkgver=2.0.0
-pkgrel=3
-pkgdesc='Mocking and Patching Library for Testing'
-url='http://www.voidspace.org.uk/python/mock/'
-makedepends=('python2' 'python' 'python-setuptools' 'python2-setuptools')
-checkdepends=('python-nose' 'python2-nose' 'python-pbr' 'python2-pbr' 'python-six' 'python2-six' 'git')
-license=('BSD')
-arch=('any')
-source=("https://files.pythonhosted.org/packages/source/m/mock/mock-$pkgver.tar.gz")
-sha512sums=('a08007651b749d2843b94f5045d74c122958888290aea21930455538a854e6b04c07115e21d82edde996154bf597d7a8784a2f4213cbabc49a98dec22dd92238')
-
-build() {
-  cd "$srcdir"
-  cp -rf "mock-$pkgver" "mock2-$pkgver"
-
-  cd "$srcdir/mock-$pkgver"
-  python3 setup.py build
-
-  cd "$srcdir/mock2-$pkgver"
-  python2 setup.py build
-}
-
-package_python-mock() {
-depends=('python' 'python-six' 'python-pbr')
-  cd "$srcdir/mock-$pkgver"
-  python3 setup.py install --optimize=1 --root="$pkgdir"
-  install -Dm644 LICENSE.txt "${pkgdir}"/usr/share/licenses/${pkgname}/LICENSE
-}
-
-package_python2-mock() {
-depends=('python2' 'python2-six' 'python2-pbr' 'python2-funcsigs') # Backported Py > 3.3 functionality
-  cd "$srcdir/mock2-$pkgver"
-  python2 setup.py install --optimize=1 --root="$pkgdir"
-  install -Dm644 LICENSE.txt "${pkgdir}"/usr/share/licenses/${pkgname}/LICENSE
-}
-
-check() {
-  cd "$srcdir/mock2-$pkgver/"
-  sed -i 's/unittest2/unittest/g'  mock/tests/*.py
-
-  echo 'python tests'
-  python -m unittest discover
-  
-  # Does not run because of self.assertRaisesRegex() usage in unitests, which is self.assertRaisesRegexp() in Python 2.7
-  echo 'python2 tests'
-  #python2 -m unittest discover
-}

Copied: python-mock/repos/community-testing-any/PKGBUILD (from rev 368430, python-mock/trunk/PKGBUILD)
===================================================================
--- PKGBUILD	                        (rev 0)
+++ PKGBUILD	2018-08-05 22:28:04 UTC (rev 368431)
@@ -0,0 +1,61 @@
+# $Id$
+# Maintainer: jelle van der Waa <jelle at vdwaa.nl>
+# Contributor: Felix Kaiser <felix.kaiser at fxkr.net>
+
+pkgbase=python-mock
+pkgname=(python2-mock python-mock)
+pkgver=2.0.0
+pkgrel=4
+pkgdesc='Mocking and Patching Library for Testing'
+url='http://www.voidspace.org.uk/python/mock/'
+makedepends=('python2' 'python' 'python-pbr' 'python2-pbr')
+checkdepends=('python2-funcsigs')
+license=('BSD')
+arch=('any')
+source=("https://files.pythonhosted.org/packages/source/m/mock/mock-$pkgver.tar.gz"
+        "0001-be-able-to-run-tests-on-python2.patch")
+sha512sums=('a08007651b749d2843b94f5045d74c122958888290aea21930455538a854e6b04c07115e21d82edde996154bf597d7a8784a2f4213cbabc49a98dec22dd92238'
+            '8da4aa25e7f35482369c6e69b4c430b0a506203b5629771cf63932f98d9c4167ed0a08c541baf4993749c24b28cacf0bb26328d34445e7e39448edb89e329f12')
+
+prepare() {
+  cd "$srcdir/mock-$pkgver"
+  # self.assertRaisesRegex() is self.assertRaisesRegexp() in Python 2.7
+  patch -p1 -i ../0001-be-able-to-run-tests-on-python2.patch
+  # use unittest instead of unittest2 as they are the same on recent python*
+  sed -i 's/unittest2/unittest/g' mock/tests/*.py
+
+  cd "$srcdir"
+  cp -rf "mock-$pkgver" "mock2-$pkgver"
+}
+
+build() {
+  cd "$srcdir/mock-$pkgver"
+  python3 setup.py build
+
+  cd "$srcdir/mock2-$pkgver"
+  python2 setup.py build
+}
+
+check() {
+  cd "$srcdir/mock-$pkgver"
+  echo 'python tests'
+  python -m unittest discover
+
+  cd "$srcdir/mock2-$pkgver"
+  echo 'python2 tests'
+  python2 -m unittest discover
+}
+
+package_python-mock() {
+depends=('python' 'python-six' 'python-pbr')
+  cd "$srcdir/mock-$pkgver"
+  python3 setup.py install --optimize=1 --root="$pkgdir"
+  install -Dm644 LICENSE.txt "${pkgdir}"/usr/share/licenses/${pkgname}/LICENSE
+}
+
+package_python2-mock() {
+depends=('python2' 'python2-six' 'python2-pbr' 'python2-funcsigs') # Backported Py > 3.3 functionality
+  cd "$srcdir/mock2-$pkgver"
+  python2 setup.py install --optimize=1 --root="$pkgdir"
+  install -Dm644 LICENSE.txt "${pkgdir}"/usr/share/licenses/${pkgname}/LICENSE
+}



More information about the arch-commits mailing list