Commits

Maciej Fijalkowski  committed 05842a2

another test

  • Participants
  • Parent commits 9bb6eb2

Comments (0)

Files changed (3)

File testing/snippets/setuptools_verify/setup.py

+
+from setuptools import setup
+import snip_setuptools_verify
+
+setup(
+    zip_safe=False,
+    packages=['snip_setuptools_verify'],
+    ext_modules=[snip_setuptools_verify.ffi.verifier.get_extension()])

File testing/snippets/setuptools_verify/snip_setuptools_verify/__init__.py

+
+from cffi import FFI
+
+ffi = FFI()
+ffi.cdef("""     // some declarations from the man page
+    struct passwd {
+        char *pw_name;
+        ...;
+    };
+    struct passwd *getpwuid(int uid);
+""")
+C = ffi.verify("""   // passed to the real C compiler
+#include <sys/types.h>
+#include <pwd.h>
+""", libraries=[])   # or a list of libraries to link with

File testing/test_integration.py

     p = snip_basic_verify.C.getpwuid(0)
     assert snip_basic_verify.ffi.string(p.pw_name) == "root"
     ''')
+
+def test_setuptools_verify():
+    venv_dir = create_venv()
+    run_setup_and_program("setuptools_verify", venv_dir, '''
+    import snip_setuptools_verify
+    p = snip_setuptools_verify.C.getpwuid(0)
+    assert snip_setuptools_verify.ffi.string(p.pw_name) == "root"
+    ''')
+