[Python-modules-commits] [pyasn1] 04/11: d/patches: fix test using sys.getsizeof()

Vincent Bernat bernat at moszumanska.debian.org
Tue Dec 26 07:22:22 UTC 2017


This is an automated email from the git hooks/post-receive script.

bernat pushed a commit to annotated tag debian/0.4.2-1
in repository pyasn1.

commit 9ed56002ea2b076d7af8329d26fedfa1591ec744
Author: Vincent Bernat <vincent at bernat.im>
Date:   Tue Dec 26 07:29:13 2017 +0100

    d/patches: fix test using sys.getsizeof()
---
 debian/changelog                                   |  1 +
 .../0001-sys.getsizeof-may-raise-TypeError.patch   | 29 ++++++++++++++++++++++
 debian/patches/series                              |  1 +
 3 files changed, 31 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 04d00bf..6ac4a8c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -6,6 +6,7 @@ pyasn1 (0.4.2-1) UNRELEASED; urgency=medium
 
   [ Vincent Bernat ]
   * New upstream release. Closes: #872724.
+  * d/patches: fix test using sys.getsizeof().
 
  -- Vincent Bernat <bernat at debian.org>  Tue, 26 Dec 2017 07:24:19 +0100
 
diff --git a/debian/patches/0001-sys.getsizeof-may-raise-TypeError.patch b/debian/patches/0001-sys.getsizeof-may-raise-TypeError.patch
new file mode 100644
index 0000000..2670457
--- /dev/null
+++ b/debian/patches/0001-sys.getsizeof-may-raise-TypeError.patch
@@ -0,0 +1,29 @@
+From: Vincent Bernat <vincent at bernat.im>
+Date: Tue, 26 Dec 2017 07:27:57 +0100
+Subject: sys.getsizeof() may raise TypeError
+
+Not all implementations have to implement getsizeof() and may raise
+TypeError instead. Notably, Pypy will always raise TypeError (unless a
+default value is provided).
+---
+ tests/type/test_univ.py | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/tests/type/test_univ.py b/tests/type/test_univ.py
+index 1999706..dc7d2cc 100644
+--- a/tests/type/test_univ.py
++++ b/tests/type/test_univ.py
+@@ -149,9 +149,13 @@ class NoValueTestCase(BaseTestCase):
+         try:
+             if hasattr(sys, 'getsizeof'):
+                 sys.getsizeof(univ.noValue)
++            else:
++                raise unittest.SkipTest("no sys.getsizeof() method")
+ 
+         except PyAsn1Error:
+             assert False, 'sizeof failed for NoValue object'
++        except TypeError:
++            raise unittest.SkipTest("sys.getsizeof() raises TypeError")
+ 
+ 
+ class IntegerTestCase(BaseTestCase):
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..8dc863b
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+0001-sys.getsizeof-may-raise-TypeError.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/pyasn1.git



More information about the Python-modules-commits mailing list