Author: Armin Rigo <[email protected]>
Branch:
Changeset: r388:40b08dc068a2
Date: 2012-06-16 11:08 +0200
http://bitbucket.org/cffi/cffi/changeset/40b08dc068a2/
Log: Fix tests for windows.
diff --git a/testing/test_function.py b/testing/test_function.py
--- a/testing/test_function.py
+++ b/testing/test_function.py
@@ -1,6 +1,6 @@
import py
from cffi import FFI
-import math, os
+import math, os, sys
from cffi.backend_ctypes import CTypesBackend
@@ -41,6 +41,8 @@
assert x == math.sin(1.23)
def test_sinf(self):
+ if sys.platform == 'win32':
+ py.test.skip("no 'sinf'")
ffi = FFI(backend=self.Backend())
ffi.cdef("""
float sinf(float x);
@@ -82,6 +84,8 @@
assert res == 'hello\n world\n'
def test_fputs(self):
+ if sys.platform == 'win32':
+ py.test.skip("no 'stderr'")
ffi = FFI(backend=self.Backend())
ffi.cdef("""
int fputs(const char *, void *);
@@ -112,11 +116,15 @@
ffi.C.printf("hello %p\n", None)
ffi.C.fflush(None)
res = fd.getvalue()
+ if sys.platform == 'win32':
+ NIL = "00000000"
+ else:
+ NIL = "(nil)"
assert res == ("hello with no arguments\n"
"hello, world!\n"
"hello, world2!\n"
"hello int 42 long 84 long long 168\n"
- "hello (nil)\n")
+ "hello " + NIL + "\n")
def test_must_specify_type_of_vararg(self):
ffi = FFI(backend=self.Backend())
@@ -175,6 +183,8 @@
assert res == 5
def test_write_variable(self):
+ if sys.platform == 'win32':
+ py.test.skip("no 'stdout'")
ffi = FFI(backend=self.Backend())
ffi.cdef("""
int puts(const char *);
@@ -205,6 +215,8 @@
assert str(q) == "world!"
def test_function_with_struct_argument(self):
+ if sys.platform == 'win32':
+ py.test.skip("no 'inet_ntoa'")
ffi = FFI(backend=self.Backend())
ffi.cdef("""
struct in_addr { unsigned int s_addr; };
diff --git a/testing/test_parsing.py b/testing/test_parsing.py
--- a/testing/test_parsing.py
+++ b/testing/test_parsing.py
@@ -1,4 +1,4 @@
-import py
+import py, sys
from cffi import FFI, CDefError
class FakeBackend(object):
@@ -10,7 +10,10 @@
return 1
def load_library(self, name):
- assert "libc" in name or "libm" in name
+ if sys.platform == 'win32':
+ assert "msvcr" in name
+ else:
+ assert "libc" in name or "libm" in name
return FakeLibrary()
def new_function_type(self, args, result, has_varargs):
diff --git a/testing/test_verify.py b/testing/test_verify.py
--- a/testing/test_verify.py
+++ b/testing/test_verify.py
@@ -1,13 +1,14 @@
import py
-import math
+import sys, math
from cffi import FFI, VerificationError, VerificationMissing, model
-class FFI(FFI):
- def verify(self, *args, **kwds):
- # XXX a GCC-only way to say "crash upon warnings too"
- return super(FFI, self).verify(*args, extra_compile_args=['-Werror'],
- **kwds)
+if sys.platform != 'win32':
+ class FFI(FFI):
+ def verify(self, *args, **kwds):
+ # XXX a GCC-only way to say "crash upon warnings too"
+ return super(FFI, self).verify(
+ *args, extra_compile_args=['-Werror'], **kwds)
def test_missing_function():
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit