python-cffi/e2e324a2f13e3a646de6f6ff03e90ed7d37e2636.patch
2018-09-19 18:44:24 +00:00

33 lines
1.1 KiB
Diff

# HG changeset patch
# User Armin Rigo <arigo@tunes.org>
# Date 1537369554 -7200
# Node ID e2e324a2f13e3a646de6f6ff03e90ed7d37e2636
# Parent 8076f2ac1bd2b68b7015fb1fb936bd6907946756
Issue #384
Un-ignore the warnings when testing for them, in case someone runs
py.test with the PYTHONWARNINGS environment variable set
diff --git a/c/test_c.py b/c/test_c.py
--- a/c/test_c.py
+++ b/c/test_c.py
@@ -3968,6 +3968,7 @@
z3 = cast(BVoidP, 0)
z4 = cast(BUCharP, 0)
with warnings.catch_warnings(record=True) as w:
+ warnings.simplefilter("always")
newp(new_pointer_type(BIntP), z1) # warn
assert len(w) == 1
newp(new_pointer_type(BVoidP), z1) # fine
diff --git a/testing/cffi0/backend_tests.py b/testing/cffi0/backend_tests.py
--- a/testing/cffi0/backend_tests.py
+++ b/testing/cffi0/backend_tests.py
@@ -1386,6 +1386,7 @@
ffi = FFI(backend=self.Backend())
ffi.cdef("enum foo;")
with warnings.catch_warnings(record=True) as log:
+ warnings.simplefilter("always")
n = ffi.cast("enum foo", -1)
assert int(n) == 0xffffffff
assert str(log[0].message) == (