summaryrefslogtreecommitdiff
path: root/testing/test_zdistutils.py
diff options
context:
space:
mode:
authorArmin Rigo <arigo@tunes.org>2012-07-15 21:38:11 +0200
committerArmin Rigo <arigo@tunes.org>2012-07-15 21:38:11 +0200
commitbb6ba8f2585500d764d04eb041f7c183f5fc28cf (patch)
tree87c855b1559aa3357af01ebfd04ddc793fc1d8af /testing/test_zdistutils.py
parent3590b78e843df487c612ca7217c7d2e4d70865a1 (diff)
downloadcffi-bb6ba8f2585500d764d04eb041f7c183f5fc28cf.tar.gz
Test and fix
Diffstat (limited to 'testing/test_zdistutils.py')
-rw-r--r--testing/test_zdistutils.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/testing/test_zdistutils.py b/testing/test_zdistutils.py
index cb69226..49ee070 100644
--- a/testing/test_zdistutils.py
+++ b/testing/test_zdistutils.py
@@ -1,4 +1,4 @@
-import os, imp, math, StringIO
+import os, imp, math, StringIO, random
import py
from cffi import FFI, FFIError
from cffi.verifier import Verifier
@@ -121,3 +121,12 @@ def test_extension_object():
assert ext.sources == [os.path.abspath(v.sourcefilename)]
assert ext.name == v.get_module_name()
assert ext.define_macros == [('TEST_EXTENSION_OBJECT', '1')]
+
+def test_extension_forces_write_source():
+ ffi = FFI()
+ ffi.cdef("double sin(double x);")
+ csrc = '/*hi there!%r*/\n#include <math.h>\n' % random.random()
+ v = Verifier(ffi, csrc)
+ assert not os.path.exists(v.sourcefilename)
+ v.get_extension()
+ assert os.path.exists(v.sourcefilename)