diff options
Diffstat (limited to 'testing/cffi0/test_verify.py')
-rw-r--r-- | testing/cffi0/test_verify.py | 190 |
1 files changed, 95 insertions, 95 deletions
diff --git a/testing/cffi0/test_verify.py b/testing/cffi0/test_verify.py index de1608d..96d752d 100644 --- a/testing/cffi0/test_verify.py +++ b/testing/cffi0/test_verify.py @@ -1,4 +1,4 @@ -import py, re +import re import pytest import sys, os, math, weakref from cffi import FFI, VerificationError, VerificationMissing, model, FFIError @@ -84,10 +84,10 @@ def test_simple_case(): def _Wconversion(cdef, source, **kargs): if sys.platform in ('win32', 'darwin'): - py.test.skip("needs GCC") + pytest.skip("needs GCC") ffi = FFI() ffi.cdef(cdef) - py.test.raises(VerificationError, ffi.verify, source, **kargs) + pytest.raises(VerificationError, ffi.verify, source, **kargs) extra_compile_args_orig = extra_compile_args[:] extra_compile_args.remove('-Wconversion') try: @@ -207,7 +207,7 @@ def test_longdouble_precision(): assert abs(more_precise - 0.656769) < 0.001 assert abs(less_precise - 3.99091) < 0.001 else: - py.test.skip("don't know the very exact precision of 'long double'") + pytest.skip("don't know the very exact precision of 'long double'") all_primitive_types = model.PrimitiveType.ALL_PRIMITIVE_TYPES @@ -260,7 +260,7 @@ def test_all_integer_and_float_types(): if sys.version < '3': assert foo(long(44)) == 45 assert foo(ffi.cast(typename, 46)) == 47 - py.test.raises(TypeError, foo, ffi.NULL) + pytest.raises(TypeError, foo, ffi.NULL) # # check for overflow cases if all_primitive_types[typename] == 'f': @@ -269,7 +269,7 @@ def test_all_integer_and_float_types(): 2**5, 2**10, 2**20, 2**40, 2**80]: overflows = int(ffi.cast(typename, value)) != value if overflows: - py.test.raises(OverflowError, foo, value) + pytest.raises(OverflowError, foo, value) else: assert foo(value) == value + 1 @@ -289,8 +289,8 @@ def test_var_signed_integer_types(): assert getattr(lib, varname) == max setattr(lib, varname, min) assert getattr(lib, varname) == min - py.test.raises(OverflowError, setattr, lib, varname, max+1) - py.test.raises(OverflowError, setattr, lib, varname, min-1) + pytest.raises(OverflowError, setattr, lib, varname, max+1) + pytest.raises(OverflowError, setattr, lib, varname, min-1) def test_var_unsigned_integer_types(): ffi = FFI() @@ -310,8 +310,8 @@ def test_var_unsigned_integer_types(): assert getattr(lib, varname) == max setattr(lib, varname, 0) assert getattr(lib, varname) == 0 - py.test.raises(OverflowError, setattr, lib, varname, max+1) - py.test.raises(OverflowError, setattr, lib, varname, -1) + pytest.raises(OverflowError, setattr, lib, varname, max+1) + pytest.raises(OverflowError, setattr, lib, varname, -1) def test_fn_signed_integer_types(): ffi = FFI() @@ -330,8 +330,8 @@ def test_fn_signed_integer_types(): fn = getattr(lib, fnname) assert fn(max) == max assert fn(min) == min - py.test.raises(OverflowError, fn, max + 1) - py.test.raises(OverflowError, fn, min - 1) + pytest.raises(OverflowError, fn, max + 1) + pytest.raises(OverflowError, fn, min - 1) def test_fn_unsigned_integer_types(): ffi = FFI() @@ -352,16 +352,16 @@ def test_fn_unsigned_integer_types(): fn = getattr(lib, fnname) assert fn(max) == max assert fn(0) == 0 - py.test.raises(OverflowError, fn, max + 1) - py.test.raises(OverflowError, fn, -1) + pytest.raises(OverflowError, fn, max + 1) + pytest.raises(OverflowError, fn, -1) def test_char_type(): ffi = FFI() ffi.cdef("char foo(char);") lib = ffi.verify("char foo(char x) { return ++x; }") assert lib.foo(b"A") == b"B" - py.test.raises(TypeError, lib.foo, b"bar") - py.test.raises(TypeError, lib.foo, "bar") + pytest.raises(TypeError, lib.foo, b"bar") + pytest.raises(TypeError, lib.foo, "bar") def test_wchar_type(): ffi = FFI() @@ -377,7 +377,7 @@ def test_wchar_type(): assert lib.foo(uniexample1) == uniexample2 def test_char16_char32_type(): - py.test.skip("XXX test or fully prevent char16_t and char32_t from " + pytest.skip("XXX test or fully prevent char16_t and char32_t from " "working in ffi.verify() mode") def test_no_argument(): @@ -412,11 +412,11 @@ def test_bogus_ptr(): ffi = FFI() ffi.cdef("int *foo(int *);") lib = ffi.verify("int *foo(int *a) { return a; }") - py.test.raises(TypeError, lib.foo, ffi.new("short *", 42)) + pytest.raises(TypeError, lib.foo, ffi.new("short *", 42)) def test_verify_typedefs(): - py.test.skip("ignored so far") + pytest.skip("ignored so far") types = ['signed char', 'unsigned char', 'int', 'long'] for cdefed in types: for real in types: @@ -425,7 +425,7 @@ def test_verify_typedefs(): if cdefed == real: ffi.verify("typedef %s foo_t;" % real) else: - py.test.raises(VerificationError, ffi.verify, + pytest.raises(VerificationError, ffi.verify, "typedef %s foo_t;" % real) def test_nondecl_struct(): @@ -441,19 +441,19 @@ def test_ffi_full_struct(): ffi.verify("struct foo_s { char x; int y; long *z; };") # if sys.platform != 'win32': # XXX fixme: only gives warnings - py.test.raises(VerificationError, ffi.verify, + pytest.raises(VerificationError, ffi.verify, "struct foo_s { char x; int y; int *z; };") # - py.test.raises(VerificationError, ffi.verify, + pytest.raises(VerificationError, ffi.verify, "struct foo_s { int y; long *z; };") # - e = py.test.raises(VerificationError, ffi.verify, + e = pytest.raises(VerificationError, ffi.verify, "struct foo_s { int y; char x; long *z; };") assert str(e.value) == ( "struct foo_s: wrong offset for field 'x'" " (we have 0, but C compiler says 4)") # - e = py.test.raises(VerificationError, ffi.verify, + e = pytest.raises(VerificationError, ffi.verify, "struct foo_s { char x; int y; long *z; char extra; };") assert str(e.value) == ( "struct foo_s: wrong total size" @@ -466,7 +466,7 @@ def test_ffi_full_struct(): # that replaces what is just padding in our declaration above ffi.verify("struct foo_s { char x, extra; int y; long *z; };") # - e = py.test.raises(VerificationError, ffi.verify, + e = pytest.raises(VerificationError, ffi.verify, "struct foo_s { char x; short pad; short y; long *z; };") assert str(e.value) == ( "struct foo_s: wrong size for field 'y'" @@ -480,9 +480,9 @@ def test_ffi_nonfull_struct(): ...; }; """) - py.test.raises(VerificationMissing, ffi.sizeof, 'struct foo_s') - py.test.raises(VerificationMissing, ffi.offsetof, 'struct foo_s', 'x') - py.test.raises(VerificationMissing, ffi.new, 'struct foo_s *') + pytest.raises(VerificationMissing, ffi.sizeof, 'struct foo_s') + pytest.raises(VerificationMissing, ffi.offsetof, 'struct foo_s', 'x') + pytest.raises(VerificationMissing, ffi.new, 'struct foo_s *') ffi.verify(""" struct foo_s { int a, b, x, c, d, e; @@ -535,7 +535,7 @@ def test_struct_signedness_ignored(): def test_struct_float_vs_int(): if sys.platform == 'win32': - py.test.skip("XXX fixme: only gives warnings") + pytest.skip("XXX fixme: only gives warnings") ffi = FFI() for typename in all_signed_integer_types(ffi): for real in all_float_types: @@ -586,7 +586,7 @@ def test_struct_array_guess_length(): def test_struct_array_c99_1(): if sys.platform == 'win32': - py.test.skip("requires C99") + pytest.skip("requires C99") ffi = FFI() ffi.cdef("struct foo_s { int x; int a[]; };") ffi.verify("struct foo_s { int x; int a[]; };") @@ -609,7 +609,7 @@ def test_struct_array_c99_1(): def test_struct_array_c99_2(): if sys.platform == 'win32': - py.test.skip("requires C99") + pytest.skip("requires C99") ffi = FFI() ffi.cdef("struct foo_s { int x; int a[]; ...; };") ffi.verify("struct foo_s { int x, y; int a[]; };") @@ -658,7 +658,7 @@ def test_struct_with_bitfield_enum(): def test_unsupported_struct_with_bitfield_ellipsis(): ffi = FFI() - py.test.raises(NotImplementedError, ffi.cdef, + pytest.raises(NotImplementedError, ffi.cdef, "struct foo_s { int a:2, b:3; ...; };") def test_global_constants(): @@ -705,7 +705,7 @@ def test_global_constants_non_int(): def test_nonfull_enum(): ffi = FFI() ffi.cdef("enum ee { EE1, EE2, EE3, ... \n \t };") - py.test.raises(VerificationMissing, ffi.cast, 'enum ee', 'EE2') + pytest.raises(VerificationMissing, ffi.cast, 'enum ee', 'EE2') ffi.verify("enum ee { EE1=10, EE2, EE3=-10, EE4 };") assert ffi.string(ffi.cast('enum ee', 11)) == "EE2" assert ffi.string(ffi.cast('enum ee', -10)) == "EE3" @@ -721,8 +721,8 @@ def test_full_enum(): ffi = FFI() ffi.cdef("enum ee { EE1, EE2, EE3 };") ffi.verify("enum ee { EE1, EE2, EE3 };") - py.test.raises(VerificationError, ffi.verify, "enum ee { EE1, EE2 };") - e = py.test.raises(VerificationError, ffi.verify, + pytest.raises(VerificationError, ffi.verify, "enum ee { EE1, EE2 };") + e = pytest.raises(VerificationError, ffi.verify, "enum ee { EE1, EE3, EE2 };") assert str(e.value) == 'enum ee: EE2 has the real value 2, not 1' # extra items cannot be seen and have no bad consequence anyway @@ -757,14 +757,14 @@ def test_nonfull_anonymous_enum(): def test_nonfull_enum_syntax2(): ffi = FFI() ffi.cdef("enum ee { EE1, EE2=\t..., EE3 };") - py.test.raises(VerificationMissing, ffi.cast, 'enum ee', 'EE1') + pytest.raises(VerificationMissing, ffi.cast, 'enum ee', 'EE1') ffi.verify("enum ee { EE1=10, EE2, EE3=-10, EE4 };") assert ffi.string(ffi.cast('enum ee', 11)) == 'EE2' assert ffi.string(ffi.cast('enum ee', -10)) == 'EE3' # ffi = FFI() ffi.cdef("enum ee { EE1, EE2=\t... };") - py.test.raises(VerificationMissing, ffi.cast, 'enum ee', 'EE1') + pytest.raises(VerificationMissing, ffi.cast, 'enum ee', 'EE1') ffi.verify("enum ee { EE1=10, EE2, EE3=-10, EE4 };") assert ffi.string(ffi.cast('enum ee', 11)) == 'EE2' # @@ -851,7 +851,7 @@ def test_access_array_variable(length=5): # work with array instances whose length we know. using a pointer # instead of an array gives the correct effects. assert repr(lib.somenumber).startswith("<cdata 'int *' 0x") - py.test.raises(TypeError, len, lib.somenumber) + pytest.raises(TypeError, len, lib.somenumber) else: assert repr(lib.somenumber).startswith("<cdata 'int[%s]' 0x" % length) assert len(lib.somenumber) == 5 @@ -1016,10 +1016,10 @@ def test_varargs(): def test_varargs_exact(): if sys.platform == 'win32': - py.test.skip("XXX fixme: only gives warnings") + pytest.skip("XXX fixme: only gives warnings") ffi = FFI() ffi.cdef("int foo(int x, ...);") - py.test.raises(VerificationError, ffi.verify, """ + pytest.raises(VerificationError, ffi.verify, """ int foo(long long x, ...) { return x; } @@ -1075,7 +1075,7 @@ def test_autofilled_struct_as_argument_dynamic(): } static int (*foo)(struct foo_s s) = &foo1; """) - e = py.test.raises(NotImplementedError, lib.foo, "?") + e = pytest.raises(NotImplementedError, lib.foo, "?") msg = ("ctype 'struct foo_s' not supported as argument. It is a struct " 'declared with "...;", but the C calling convention may depend on ' "the missing fields; or, it contains anonymous struct/unions. " @@ -1152,7 +1152,7 @@ def test_enum_as_argument(): int foo_func(enum foo_e e) { return (int)e; } """) assert lib.foo_func(lib.BB) == 2 - py.test.raises(TypeError, lib.foo_func, "BB") + pytest.raises(TypeError, lib.foo_func, "BB") def test_enum_as_function_result(): ffi = FFI() @@ -1185,7 +1185,7 @@ def test_typedef_complete_enum(): def test_typedef_broken_complete_enum(): ffi = FFI() ffi.cdef("typedef enum { AA, BB } enum1_t;") - py.test.raises(VerificationError, ffi.verify, + pytest.raises(VerificationError, ffi.verify, "typedef enum { AA, CC, BB } enum1_t;") def test_typedef_incomplete_enum(): @@ -1208,7 +1208,7 @@ def test_typedef_enum_as_argument(): int foo_func(foo_t e) { return (int)e; } """) assert lib.foo_func(lib.BB) == lib.BB == 2 - py.test.raises(TypeError, lib.foo_func, "BB") + pytest.raises(TypeError, lib.foo_func, "BB") def test_typedef_enum_as_function_result(): ffi = FFI() @@ -1234,9 +1234,9 @@ def test_function_typedef(): def test_opaque_integer_as_function_result(): #import platform #if platform.machine().startswith('sparc'): - # py.test.skip('Breaks horribly on sparc (SIGILL + corrupted stack)') + # pytest.skip('Breaks horribly on sparc (SIGILL + corrupted stack)') #elif platform.machine() == 'mips64' and sys.maxsize > 2**32: - # py.test.skip('Segfaults on mips64el') + # pytest.skip('Segfaults on mips64el') # XXX bad abuse of "struct { ...; }". It only works a bit by chance # anyway. XXX think about something better :-( ffi = FFI() @@ -1288,7 +1288,7 @@ def test_take_and_return_partial_structs(): def test_cannot_name_struct_type(): ffi = FFI() ffi.cdef("typedef struct { int x; } **sp; void foo(sp);") - e = py.test.raises(VerificationError, ffi.verify, + e = pytest.raises(VerificationError, ffi.verify, "typedef struct { int x; } **sp; void foo(sp x) { }") assert 'in argument of foo: unknown type name' in str(e.value) @@ -1300,7 +1300,7 @@ def test_dont_check_unnamable_fields(): def test_nested_anonymous_struct_exact(): if sys.platform == 'win32': - py.test.skip("nested anonymous struct/union") + pytest.skip("nested anonymous struct/union") ffi = FFI() ffi.cdef(""" struct foo_s { struct { int a; char b; }; union { char c, d; }; }; @@ -1320,15 +1320,15 @@ def test_nested_anonymous_struct_exact(): def test_nested_anonymous_struct_exact_error(): if sys.platform == 'win32': - py.test.skip("nested anonymous struct/union") + pytest.skip("nested anonymous struct/union") ffi = FFI() ffi.cdef(""" struct foo_s { struct { int a; char b; }; union { char c, d; }; }; """) - py.test.raises(VerificationError, ffi.verify, """ + pytest.raises(VerificationError, ffi.verify, """ struct foo_s { struct { int a; short b; }; union { char c, d; }; }; """) - py.test.raises(VerificationError, ffi.verify, """ + pytest.raises(VerificationError, ffi.verify, """ struct foo_s { struct { int a; char e, b; }; union { char c, d; }; }; """) @@ -1389,7 +1389,7 @@ def test_ffi_union_with_partial_struct_2(): def test_ffi_struct_packed(): if sys.platform == 'win32': - py.test.skip("needs a GCC extension") + pytest.skip("needs a GCC extension") ffi = FFI() ffi.cdef("struct foo_s { int b; ...; };") ffi.verify(""" @@ -1440,7 +1440,7 @@ def test_bug1(): def test_bool(): if sys.platform == 'win32': - py.test.skip("_Bool not in MSVC") + pytest.skip("_Bool not in MSVC") ffi = FFI() ffi.cdef("struct foo_s { _Bool x; };" "_Bool foo(_Bool); static _Bool (*foop)(_Bool);") @@ -1464,13 +1464,13 @@ def test_bool(): assert lib.foop(1) is False assert lib.foop(True) is False assert lib.foop(0) is True - py.test.raises(OverflowError, lib.foop, 42) - py.test.raises(TypeError, lib.foop, 0.0) + pytest.raises(OverflowError, lib.foop, 42) + pytest.raises(TypeError, lib.foop, 0.0) assert lib.foo(1) is False assert lib.foo(True) is False assert lib.foo(0) is True - py.test.raises(OverflowError, lib.foo, 42) - py.test.raises(TypeError, lib.foo, 0.0) + pytest.raises(OverflowError, lib.foo, 42) + pytest.raises(TypeError, lib.foo, 0.0) assert int(ffi.cast("_Bool", long(1))) == 1 assert int(ffi.cast("_Bool", long(0))) == 0 assert int(ffi.cast("_Bool", long(-1))) == 1 @@ -1491,14 +1491,14 @@ def test_bool(): assert int(ffi.cast("_Bool", f)) == 0 assert f.seen # - py.test.raises(TypeError, ffi.cast, "_Bool", []) + pytest.raises(TypeError, ffi.cast, "_Bool", []) def test_bool_on_long_double(): if sys.platform == 'win32': - py.test.skip("_Bool not in MSVC") + pytest.skip("_Bool not in MSVC") f = 1E-250 if f == 0.0 or f*f != 0.0: - py.test.skip("unexpected precision") + pytest.skip("unexpected precision") ffi = FFI() ffi.cdef("long double square(long double f); _Bool opposite(_Bool);") lib = ffi.verify("long double square(long double f) { return f*f; }\n" @@ -1507,12 +1507,12 @@ def test_bool_on_long_double(): f2 = lib.square(f) f3 = lib.square(f * 2.0) if repr(f2) == repr(f3): - py.test.skip("long double doesn't have enough precision") + pytest.skip("long double doesn't have enough precision") assert float(f0) == float(f2) == float(f3) == 0.0 # too tiny for 'double' assert int(ffi.cast("_Bool", f2)) == 1 assert int(ffi.cast("_Bool", f3)) == 1 assert int(ffi.cast("_Bool", f0)) == 0 - py.test.raises(TypeError, lib.opposite, f2) + pytest.raises(TypeError, lib.opposite, f2) def test_cannot_pass_float(): for basetype in ['char', 'short', 'int', 'long', 'long long']: @@ -1532,7 +1532,7 @@ def test_cannot_pass_float(): p.x = 0.0 assert lib.foo(42) == 0 assert lib.foo(0) == 1 - py.test.raises(TypeError, lib.foo, 0.0) + pytest.raises(TypeError, lib.foo, 0.0) def test_cast_from_int_type_to_bool(): ffi = FFI() @@ -1563,18 +1563,18 @@ def test_addressof(): p = ffi.new("struct foo_s *") p.point.x = 16 p.point.y = 9 - py.test.raises(TypeError, lib.sum_coord, p.point) + pytest.raises(TypeError, lib.sum_coord, p.point) res = lib.sum_coord(ffi.addressof(p.point)) assert res.x == 25 assert res.y == 7 res2 = lib.sum_coord(ffi.addressof(res)) assert res2.x == 32 assert res2.y == 18 - py.test.raises(TypeError, lib.sum_coord, res2) + pytest.raises(TypeError, lib.sum_coord, res2) def test_callback_in_thread(): if sys.platform == 'win32': - py.test.skip("pthread only") + pytest.skip("pthread only") import os, subprocess, imp arg = os.path.join(os.path.dirname(__file__), 'callback_in_thread.py') g = subprocess.Popen([sys.executable, arg, @@ -1610,7 +1610,7 @@ def test_keepalive_ffi(): def test_FILE_stored_in_stdout(): if not sys.platform.startswith('linux') or is_musl: - py.test.skip("likely, we cannot assign to stdout") + pytest.skip("likely, we cannot assign to stdout") ffi = FFI() ffi.cdef("int printf(const char *, ...); FILE *setstdout(FILE *);") lib = ffi.verify(""" @@ -1682,7 +1682,7 @@ def test_global_array_with_dotdotdot_length(): def test_bad_global_array_with_dotdotdot_length(): ffi = FFI() ffi.cdef("extern int fooarray[...];") - py.test.raises(VerificationError, ffi.verify, "char fooarray[23];") + pytest.raises(VerificationError, ffi.verify, "char fooarray[23];") def test_struct_containing_struct(): ffi = FFI() @@ -1696,7 +1696,7 @@ def test_struct_containing_struct(): def test_struct_returned_by_func(): ffi = FFI() ffi.cdef("typedef ... foo_t; foo_t myfunc(void);") - e = py.test.raises(TypeError, ffi.verify, + e = pytest.raises(TypeError, ffi.verify, "typedef struct { int x; } foo_t; " "foo_t myfunc(void) { foo_t x = { 42 }; return x; }") assert str(e.value) == ( @@ -1780,7 +1780,7 @@ def test_enum_bug118(): continue # enums may always be signed with MSVC ffi = FFI() ffi.cdef("enum foo_e { AA=%s };" % c1) - e = py.test.raises(VerificationError, ffi.verify, + e = pytest.raises(VerificationError, ffi.verify, "enum foo_e { AA=%s%s };" % (c2, c2c)) assert str(e.value) == ('enum foo_e: AA has the real value %d, not %d' % (c2, c1)) @@ -1885,15 +1885,15 @@ def test_passing_string_or_NULL(): assert lib.seeme1(ffi.NULL) == 1 assert lib.seeme2([42, 43]) == 0 assert lib.seeme2(ffi.NULL) == 1 - py.test.raises(TypeError, lib.seeme1, None) - py.test.raises(TypeError, lib.seeme2, None) - py.test.raises(TypeError, lib.seeme1, 0.0) - py.test.raises(TypeError, lib.seeme2, 0.0) - py.test.raises(TypeError, lib.seeme1, 0) - py.test.raises(TypeError, lib.seeme2, 0) + pytest.raises(TypeError, lib.seeme1, None) + pytest.raises(TypeError, lib.seeme2, None) + pytest.raises(TypeError, lib.seeme1, 0.0) + pytest.raises(TypeError, lib.seeme2, 0.0) + pytest.raises(TypeError, lib.seeme1, 0) + pytest.raises(TypeError, lib.seeme2, 0) zeroL = 99999999999999999999 zeroL -= 99999999999999999999 - py.test.raises(TypeError, lib.seeme2, zeroL) + pytest.raises(TypeError, lib.seeme2, zeroL) def test_typeof_function(): ffi = FFI() @@ -2120,7 +2120,7 @@ def test_errno_working_even_with_pypys_jit(): def test_getlasterror_working_even_with_pypys_jit(): if sys.platform != 'win32': - py.test.skip("win32-only test") + pytest.skip("win32-only test") ffi = FFI() ffi.cdef("void SetLastError(DWORD);") lib = ffi.dlopen("Kernel32.dll") @@ -2167,19 +2167,19 @@ def test_consider_not_implemented_function_type(): bazptr = ffi.cast("bazfunc_t", 123) barptr = ffi.cast("barfunc_t", 123) # assert did not crash so far - e = py.test.raises(NotImplementedError, fooptr, ffi.new("Data *")) + e = pytest.raises(NotImplementedError, fooptr, ffi.new("Data *")) assert str(e.value) == ( "ctype 'Data' not supported as argument by libffi. Unions are only " "supported as argument if the function is 'API mode' and " "non-variadic (i.e. declared inside ffibuilder.cdef()+" "ffibuilder.set_source() and not taking a final '...' argument)") - e = py.test.raises(NotImplementedError, bazptr) + e = pytest.raises(NotImplementedError, bazptr) assert str(e.value) == ( "ctype 'Data' not supported as return value by libffi. Unions are " "only supported as return value if the function is 'API mode' and " "non-variadic (i.e. declared inside ffibuilder.cdef()+" "ffibuilder.set_source() and not taking a final '...' argument)") - e = py.test.raises(NotImplementedError, barptr) + e = pytest.raises(NotImplementedError, barptr) assert str(e.value) == ( "ctype 'MyStr' not supported as return value. It is a struct with " "bit fields, which libffi does not support. Such structs are only " @@ -2195,9 +2195,9 @@ def test_verify_extra_arguments(): def test_implicit_unicode_on_windows(): if sys.platform != 'win32': - py.test.skip("win32-only test") + pytest.skip("win32-only test") ffi = FFI() - e = py.test.raises(FFIError, ffi.cdef, "int foo(LPTSTR);") + e = pytest.raises(FFIError, ffi.cdef, "int foo(LPTSTR);") assert str(e.value) == ("The Windows type 'LPTSTR' is only available after" " you call ffi.set_unicode()") for with_unicode in [True, False]: @@ -2235,7 +2235,7 @@ def test_define_known_value(): def test_define_wrong_value(): ffi = FFI() ffi.cdef("#define FOO 123") - e = py.test.raises(VerificationError, ffi.verify, "#define FOO 124") + e = pytest.raises(VerificationError, ffi.verify, "#define FOO 124") assert str(e.value).endswith("FOO has the real value 124, not 123") def test_static_const_int_known_value(): @@ -2247,7 +2247,7 @@ def test_static_const_int_known_value(): def test_static_const_int_wrong_value(): ffi = FFI() ffi.cdef("static const int FOO = 123;") - e = py.test.raises(VerificationError, ffi.verify, "#define FOO 124") + e = pytest.raises(VerificationError, ffi.verify, "#define FOO 124") assert str(e.value).endswith("FOO has the real value 124, not 123") def test_const_struct_global(): @@ -2261,12 +2261,12 @@ def test_const_struct_global(): def test_dont_support_int_dotdotdot(): ffi = FFI() ffi.cdef("typedef int... t1;") - e = py.test.raises(VerificationError, ffi.verify, "") + e = pytest.raises(VerificationError, ffi.verify, "") assert str(e.value) == ("feature not supported with ffi.verify(), but only " "with ffi.set_source(): 'typedef int... t1'") ffi = FFI() ffi.cdef("typedef double ... t1;") - e = py.test.raises(VerificationError, ffi.verify, "") + e = pytest.raises(VerificationError, ffi.verify, "") assert str(e.value) == ("feature not supported with ffi.verify(), but only " "with ffi.set_source(): 'typedef float... t1'") @@ -2326,8 +2326,8 @@ def test_win32_calling_convention_0(): if sys.platform == 'win32' and sys.maxsize < 2**32: assert '__stdcall' in str(ffi.typeof(cb2)) assert '__stdcall' not in str(ffi.typeof(cb1)) - py.test.raises(TypeError, lib.call1, cb2) - py.test.raises(TypeError, lib.call2, cb1) + pytest.raises(TypeError, lib.call1, cb2) + pytest.raises(TypeError, lib.call2, cb1) else: assert '__stdcall' not in str(ffi.typeof(cb2)) assert ffi.typeof(cb2) is ffi.typeof(cb1) @@ -2450,8 +2450,8 @@ def test_win32_calling_convention_3(): } """) if sys.platform == 'win32' and sys.maxsize < 2**32: - py.test.raises(TypeError, lib.call1, lib.cb2) - py.test.raises(TypeError, lib.call2, lib.cb1) + pytest.raises(TypeError, lib.call1, lib.cb2) + pytest.raises(TypeError, lib.call2, lib.cb1) pt = lib.call1(lib.cb1) assert (pt.x, pt.y) == (-9*500*999, 9*500*999) pt = lib.call2(lib.cb2) @@ -2459,11 +2459,11 @@ def test_win32_calling_convention_3(): def _only_test_on_linux_intel(): if not sys.platform.startswith('linux'): - py.test.skip('only running the memory-intensive test on Linux') + pytest.skip('only running the memory-intensive test on Linux') import platform machine = platform.machine() if 'x86' not in machine and 'x64' not in machine: - py.test.skip('only running the memory-intensive test on x86/x64') + pytest.skip('only running the memory-intensive test on x86/x64') def test_ffi_gc_size_arg(): # with PyPy's GC, these calls to ffi.gc() would rapidly consume @@ -2487,7 +2487,7 @@ def test_ffi_gc_size_arg_2(): # and I found no obvious way to prevent that. So for now, this test # is skipped on CPython, where it eats all the memory. if '__pypy__' not in sys.builtin_module_names: - py.test.skip("find a way to tweak the cyclic GC of CPython") + pytest.skip("find a way to tweak the cyclic GC of CPython") _only_test_on_linux_intel() ffi = FFI() ffi.cdef("void *malloc(size_t); void free(void *);") @@ -2510,7 +2510,7 @@ def test_ffi_gc_size_arg_2(): def test_ffi_new_with_cycles(): # still another variant, with ffi.new() if '__pypy__' not in sys.builtin_module_names: - py.test.skip("find a way to tweak the cyclic GC of CPython") + pytest.skip("find a way to tweak the cyclic GC of CPython") ffi = FFI() ffi.cdef("") lib = ffi.verify("") |