diff --git a/test/support.py b/test/support.py index 4c3c8fc7..b69ca309 100644 --- a/test/support.py +++ b/test/support.py @@ -73,3 +73,4 @@ def setup_make(targetname): #else true #endif\n""") == 1) +IS_CLING = not IS_CLANG_REPL diff --git a/test/test_boost.py b/test/test_boost.py index a000de37..a3eb38f1 100644 --- a/test/test_boost.py +++ b/test/test_boost.py @@ -28,7 +28,7 @@ def test01_any_class(self): assert std.list[any] - @mark.xfail + @mark.skip def test02_any_usage(self): """boost::any assignment and casting""" @@ -101,7 +101,7 @@ def setup_class(cls): cppyy.include("boost/variant/variant.hpp") cppyy.include("boost/variant/get.hpp") - @mark.xfail + @mark.skip def test01_variant_usage(self): """boost::variant usage""" @@ -130,6 +130,10 @@ class C { }; } """) assert v.back().which() == 2 assert type(boost.get['BV::A'](v[0])) == cpp.BV.A + + # Trying to raise this exception seg faults, by trying to execute an unfit instantiation. + # This comes from `Instantiate` obtaining a single handle and providing a result + # The same issue happens with trying `BestOverloadFunctionMatch` first since the candidate set is single raises(Exception, boost.get['BV::B'], v[0]) assert type(boost.get['BV::B'](v[1])) == cpp.BV.B assert type(boost.get['BV::C'](v[2])) == cpp.BV.C diff --git a/test/test_conversions.py b/test/test_conversions.py index ff69a915..c9783df2 100644 --- a/test/test_conversions.py +++ b/test/test_conversions.py @@ -1,6 +1,6 @@ import py, os, sys from pytest import raises, mark -from .support import setup_make +from .support import setup_make, IS_LINUX, IS_CLANG_REPL, IS_CLING, IS_MAC currpath = py.path.local(__file__).dirpath() test_dct = str(currpath.join("conversionsDict")) @@ -87,7 +87,7 @@ def test03_error_handling(self): gc.collect() assert CC.s_count == 0 - @mark.xfail + @mark.xfail(run = not(IS_LINUX and IS_CLING), condition = IS_MAC or IS_CLING, reason = "Fails on OS X + Cling, Crashes on Linux + Cling") def test04_implicit_conversion_from_tuple(self): """Allow implicit conversions from tuples as arguments {}-like""" diff --git a/test/test_cpp11features.py b/test/test_cpp11features.py index 0d55c13b..f19299e4 100644 --- a/test/test_cpp11features.py +++ b/test/test_cpp11features.py @@ -1,6 +1,6 @@ import py, os, sys from pytest import raises, mark -from .support import setup_make, ispypy, IS_CLANG_REPL, IS_LINUX_ARM +from .support import setup_make, ispypy, IS_CLANG_REPL, IS_LINUX_ARM, IS_LINUX, IS_MAC, IS_CLING currpath = py.path.local(__file__).dirpath() @@ -44,7 +44,7 @@ def test01_smart_ptr(self): gc.collect() assert TestSmartPtr.s_counter == 0 - @mark.xfail(run=False, reason="Crashes") + @mark.xfail(run = False, condition=IS_LINUX_ARM, reason="Valgrind issues") def test02_smart_ptr_construction(self): """Shared/Unique pointer ctor is templated, requiring special care""" @@ -72,7 +72,7 @@ class C(TestSmartPtr): gc.collect() assert TestSmartPtr.s_counter == 0 - @mark.xfail(run=False, reason="Crashes") + @mark.xfail(run = False, condition = IS_LINUX, reason = "Passes, but Valgrind issue") def test03_smart_ptr_memory_handling(self): """Test shared/unique pointer memory ownership""" @@ -103,7 +103,7 @@ class C(TestSmartPtr): gc.collect() assert TestSmartPtr.s_counter == 0 - @mark.xfail(run=False, reason="Crashes") + @mark.xfail def test04_shared_ptr_passing(self): """Ability to pass shared_ptr through shared_ptr""" @@ -409,7 +409,7 @@ def test13_stdhash(self): assert hash(sw) == 17 assert hash(sw) == 17 - @mark.xfail(run=False, reason="Crashes") + @mark.xfail def test14_shared_ptr_passing(self): """Ability to pass normal pointers through shared_ptr by value""" @@ -435,7 +435,7 @@ def test14_shared_ptr_passing(self): gc.collect() assert TestSmartPtr.s_counter == 0 - @mark.xfail + @mark.xfail(condition=IS_CLING, reason = "Fails on Cling") def test15_unique_ptr_template_deduction(self): """Argument type deduction with std::unique_ptr""" diff --git a/test/test_crossinheritance.py b/test/test_crossinheritance.py index 7d6c81b3..9bab6994 100644 --- a/test/test_crossinheritance.py +++ b/test/test_crossinheritance.py @@ -1,6 +1,6 @@ import py, os, sys from pytest import raises, skip, mark -from .support import setup_make, pylong, IS_MAC_ARM, IS_MAC, IS_CLANG_REPL, IS_CLANG_DEBUG, IS_LINUX_ARM +from .support import setup_make, pylong, IS_MAC_ARM, IS_MAC, IS_CLANG_REPL, IS_CLANG_DEBUG, IS_LINUX_ARM, IS_LINUX currpath = py.path.local(__file__).dirpath() @@ -130,7 +130,7 @@ def get_value(self): assert c4.m_int == 88 assert CX.IBase2.call_get_value(c4) == 77 - @mark.xfail(condition=IS_MAC_ARM, run=not IS_MAC_ARM, reason="Crashes with exception not being caught on Apple Silicon") + @mark.xfail(run=False, condition=IS_MAC_ARM, reason="Crashes with exception not being caught on Apple Silicon") def test04_arguments(self): """Test ability to override functions that take arguments""" @@ -405,7 +405,7 @@ def call(self): gc.collect() assert CB.s_count == 0 + start_count - @mark.xfail(run=False, reason="Crashes") + @mark.xfail(run = False, condition = IS_LINUX, reason = "Passes, but Valgrind issue") def test12_python_shared_ptr_memory(self): """Usage of Python derived objects with std::shared_ptr""" @@ -1034,7 +1034,7 @@ def return_const(self): assert a.return_const().m_value == "abcdef" assert ns.callit(a).m_value == "abcdef" - @mark.xfail + @mark.xfail(condition = IS_MAC, reason = "Fails on OS X") def test24_non_copyable(self): """Inheriting from a non-copyable base class""" diff --git a/test/test_datatypes.py b/test/test_datatypes.py index fb838644..3315d9a8 100644 --- a/test/test_datatypes.py +++ b/test/test_datatypes.py @@ -1,6 +1,6 @@ import py, os, sys from pytest import raises, skip, mark -from .support import setup_make, pylong, pyunicode, IS_CLANG_REPL, IS_MAC_X86, IS_MAC_ARM, IS_MAC, IS_LINUX +from .support import setup_make, pylong, pyunicode, IS_CLANG_REPL, IS_CLING, IS_MAC_X86, IS_MAC_ARM, IS_MAC, IS_LINUX IS_MAC = IS_MAC_X86 or IS_MAC_ARM @@ -1269,7 +1269,7 @@ def run(self, f, buf, total): if self.has_byte: run(self, cppyy.gbl.sum_byte_data, buf, total) - @mark.xfail(run=not(((IS_CLANG_REPL and IS_MAC) or (not IS_CLANG_REPL and IS_MAC))), reason="Crashes") + @mark.xfail(run=not(IS_MAC), reason="Crashes on OS X") def test26_function_pointers(self): """Function pointer passing""" @@ -1332,7 +1332,7 @@ def sum_in_python(i1, i2, i3): ns = cppyy.gbl.FuncPtrReturn assert ns.foo()() == "Hello, World!" - @mark.xfail(run=False, condition=(IS_CLANG_REPL and IS_MAC) or (not IS_CLANG_REPL and IS_MAC), reason="Crashes") + @mark.xfail(run=False, condition=IS_MAC, reason="Crashes") def test27_callable_passing(self): """Passing callables through function pointers""" @@ -1643,7 +1643,7 @@ def test31_anonymous_union(self): assert type(p.data_c[0]) == float assert p.intensity == 5. - @mark.xfail(condition=not IS_CLANG_REPL, reason="Fails on Cling") + @mark.xfail(condition=IS_CLING, reason="Fails on Cling") def test32_anonymous_struct(self): """Anonymous struct creates an unnamed type""" @@ -2011,7 +2011,7 @@ class Atom { assert b.name == "aap" assert b.buf_type == ns.SHAPE - @mark.xfail(run=not IS_CLANG_REPL, reason="Crashes") + @mark.xfail def test40_more_aggregates(self): """More aggregate testings (used to fail/report errors)""" @@ -2049,7 +2049,7 @@ def test40_more_aggregates(self): r2 = ns.make_R2() assert r2.s.x == 1 - @mark.xfail(run=False, reason="Fails") + @mark.xfail(condition=IS_MAC and IS_CLING, reason="Fails on OS X and Cling") def test41_complex_numpy_arrays(self): """Usage of complex numpy arrays""" @@ -2097,7 +2097,7 @@ def pycompdot(a, b, N): Ccl = func(Acl, Bcl, 2) assert complex(Ccl) == pyCcl - @mark.xfail + @mark.xfail(condition=(IS_MAC and IS_CLING), reason = "Fails on OS X Cling") def test42_mixed_complex_arithmetic(self): """Mixin of Python and C++ std::complex in arithmetic""" diff --git a/test/test_doc_features.py b/test/test_doc_features.py index de6bdea7..bdecdf3e 100644 --- a/test/test_doc_features.py +++ b/test/test_doc_features.py @@ -1,6 +1,6 @@ import py, os, sys from pytest import raises, skip, mark -from .support import setup_make, ispypy, IS_WINDOWS, IS_CLANG_REPL, IS_CLANG_DEBUG, IS_MAC, IS_MAC_X86, IS_MAC_ARM, IS_LINUX_ARM +from .support import setup_make, ispypy, IS_WINDOWS, IS_CLANG_REPL, IS_CLING, IS_CLANG_DEBUG, IS_MAC, IS_MAC_X86, IS_MAC_ARM, IS_LINUX_ARM currpath = py.path.local(__file__).dirpath() test_dct = str(currpath.join("doc_helperDict")) @@ -9,7 +9,7 @@ def setup_module(mod): setup_make("doc_helper") -@mark.skipif((IS_MAC_ARM or IS_MAC_X86) and (not IS_CLANG_REPL), reason="setup class fails with OS X cling") +@mark.skipif(IS_MAC and IS_CLING, reason="setup class fails with OS X cling") class TestDOCFEATURES: def setup_class(cls): cls.test_dct = test_dct @@ -485,7 +485,7 @@ def test_exceptions(self): assert caught == True -@mark.skipif((IS_MAC_ARM or IS_MAC_X86) and (not IS_CLANG_REPL), reason="setup class fails with OS X cling") +@mark.skipif(IS_MAC and IS_CLING, reason="setup class fails with OS X cling") class TestTUTORIALFEATURES: def setup_class(cls): import cppyy @@ -574,7 +574,7 @@ def test02_python_introspection(self): assert not isinstance(i, int) assert isinstance(i, Integer1) - @mark.xfail(run=(not IS_MAC and IS_CLANG_REPL), condition=IS_MAC and (not IS_CLANG_REPL), reason= "Crashes on OS X Cling") + @mark.xfail(run=(not IS_MAC and IS_CLANG_REPL), condition=IS_MAC and IS_CLING, reason= "Crashes on OS X Cling") def test03_STL_containers(self): """Instantiate STL containers with new class""" @@ -612,7 +612,7 @@ def pythonizor(klass, name): i2 = Integer2(13) assert int(i2) == 13 - @mark.xfail(condition=IS_MAC and not IS_CLANG_REPL, reason="Fails on OSX Cling") + @mark.xfail(condition=IS_MAC and IS_CLING, reason="Fails on OSX Cling") def test06_add_operator(self): """Add operator+""" @@ -735,7 +735,7 @@ def test10_stl_algorithm(self): assert n == 'thisisaC++stringing' -@mark.skipif((IS_MAC_ARM or IS_MAC_X86) and (not IS_CLANG_REPL), reason="setup class fails with OS X cling") +@mark.skipif(IS_MAC and IS_CLING, reason="setup class fails with OS X cling") class TestADVERTISED: def setup_class(cls): import cppyy @@ -850,7 +850,7 @@ def test03_use_of_ctypes_and_enum(self): assert list(arr) == [1, 42, 1, 42] cppyy.gbl.free(vp) - @mark.xfail(run=(not IS_MAC and IS_CLANG_REPL), condition=IS_MAC and (not IS_CLANG_REPL), reason= "Crashes on OS X Cling") + @mark.xfail(run=(not IS_MAC and IS_CLANG_REPL), condition=IS_MAC and IS_CLING, reason= "Crashes on OS X Cling") def test04_ptr_ptr_python_owns(self): """Example of ptr-ptr use where python owns""" @@ -1018,7 +1018,7 @@ def pythonize_topologic_printing(klass, name): assert str(s) == "hi there!" - @mark.xfail + @mark.xfail(condition = IS_MAC, reason = "Fails on OS X") def test10_llvm_blog(self): """Test code posted in the LLVM blog posting""" @@ -1074,7 +1074,7 @@ def produce_imp(self): # The series of tests below mostly exists already in other places, but these # were used as examples for the CaaS' cppyy presentation and are preserved here. -@mark.skipif((IS_MAC_ARM or IS_MAC_X86) and (not IS_CLANG_REPL), reason="setup class fails with OS X cling") +@mark.skipif(IS_MAC and IS_CLING, reason="setup class fails with OS X cling") class TestTALKEXAMPLES: def setup_class(cls): import cppyy @@ -1092,6 +1092,7 @@ def setup_class(cls): cppyy.gbl.talk_examples + # @mark.skip def test_template_instantiation(self): """Run-time template instantiation example""" diff --git a/test/test_eigen.py b/test/test_eigen.py index 187e244b..bb4d3cb6 100644 --- a/test/test_eigen.py +++ b/test/test_eigen.py @@ -1,6 +1,6 @@ import py, os, sys from pytest import mark, raises -from .support import setup_make, IS_CLANG_REPL, IS_MAC_X86 +from .support import setup_make, IS_CLANG_REPL, IS_CLING, IS_MAC_X86 inc_paths = [os.path.join(os.path.sep, 'usr', 'include'), os.path.join(os.path.sep, 'usr', 'local', 'include')] @@ -158,7 +158,7 @@ def setup_class(cls): warnings.simplefilter('ignore') cppyy.include('Eigen/Dense') - @mark.xfail(condition=IS_MAC_X86 and (not IS_CLANG_REPL), reason="Errors out on OS X Cling") + @mark.xfail(condition=IS_MAC_X86 and IS_CLING, reason="Errors out on OS X Cling") def test01_use_of_Map(self): """Use of Map (used to crash)""" diff --git a/test/test_lowlevel.py b/test/test_lowlevel.py index 8c982795..18443b0b 100644 --- a/test/test_lowlevel.py +++ b/test/test_lowlevel.py @@ -47,7 +47,6 @@ def test02_builtin_cpp_casts(self): assert len(ll.reinterpret_cast['int*'](0)) == 0 raises(ReferenceError, ll.reinterpret_cast['int*'](0).__getitem__, 0) - @mark.xfail def test03_memory(self): """Memory allocation and free-ing""" @@ -681,7 +680,6 @@ def test03_3D_arrays(self): assert arr[i][j][k] == val assert arr[i, j, k] == val - @mark.xfail def test04_malloc(self): """Use of malloc to create multi-dim arrays""" diff --git a/test/test_operators.py b/test/test_operators.py index ccbd8aa8..9ddd488b 100644 --- a/test/test_operators.py +++ b/test/test_operators.py @@ -1,6 +1,6 @@ import py, os, sys from pytest import raises, skip, mark -from .support import setup_make, pylong, maxvalue, IS_WINDOWS +from .support import setup_make, pylong, maxvalue, IS_WINDOWS, IS_MAC, IS_CLANG_REPL, IS_CLING currpath = py.path.local(__file__).dirpath() test_dct = str(currpath.join("operatorsDict")) @@ -224,7 +224,6 @@ def test08_call_to_getsetitem_mapping(self): assert m[1] == 74 assert m(1,2) == 74 - @mark.xfail def test09_templated_operator(self): """Templated operator<()""" @@ -296,7 +295,6 @@ def test11_overloaded_operators(self): assert v-w == 1-3 + 2-4 - @mark.xfail def test12_unary_operators(self): """Unary operator-+~""" @@ -339,7 +337,7 @@ def test14_single_argument_call(self): b = ns.Bar() assert b[42] == 42 - @mark.xfail + @mark.xfail(condition = (IS_MAC and IS_CLING), reason = "Fails on OS X Cling") def test15_class_and_global_mix(self): """Iterator methods have both class and global overloads""" diff --git a/test/test_pythonify.py b/test/test_pythonify.py index 40340bc9..725c43e4 100644 --- a/test/test_pythonify.py +++ b/test/test_pythonify.py @@ -1,6 +1,6 @@ import py, os, sys from pytest import raises, skip, mark -from .support import setup_make, pylong, ispypy, IS_CLANG_REPL, IS_MAC_ARM, IS_MAC_X86, IS_MAC +from .support import setup_make, pylong, ispypy, IS_CLANG_REPL, IS_CLING, IS_MAC_ARM, IS_MAC_X86, IS_MAC currpath = py.path.local(__file__).dirpath() test_dct = str(currpath.join("example01Dict")) @@ -379,7 +379,7 @@ def __init__(self, what): assert example01.getCount() == 0 - @mark.xfail(condition=(not IS_CLANG_REPL) and (IS_MAC_ARM or IS_MAC_X86), reason="Fails on OS X Cling") + @mark.xfail(condition = IS_MAC and IS_CLING, reason = "Fails on OS X Cling") def test17_chaining(self): """Respective return values of temporaries should not go away""" @@ -496,7 +496,7 @@ def verify_b(b, val, ti, to): with raises(TypeError): c.callme(a=1, b=2) - @mark.xfail(condition=(not IS_CLANG_REPL) or IS_MAC, reason="Fails on Cling and OSX") + @mark.xfail(condition=IS_MAC or IS_CLING, reason="Fails on Cling and OSX") def test19_keywords_and_defaults(self): """Use of keyword arguments mixed with defaults""" diff --git a/test/test_pythonization.py b/test/test_pythonization.py index 7a57ddb7..dc3e5f0b 100644 --- a/test/test_pythonization.py +++ b/test/test_pythonization.py @@ -1,6 +1,6 @@ import py, os, sys from pytest import raises, mark -from .support import setup_make, pylong, IS_MAC_X86, IS_MAC_ARM, IS_MAC, IS_CLANG_REPL +from .support import setup_make, pylong, IS_MAC_X86, IS_MAC_ARM, IS_MAC, IS_CLANG_REPL, IS_CLING currpath = py.path.local(__file__).dirpath() test_dct = str(currpath.join("pythonizablesDict")) @@ -63,7 +63,7 @@ def root_pythonizor(klass, name): assert len(cppyy.gbl.CppyyLegacy.TObjString("aap")) == 4 # include '\0' - @mark.xfail(condition=(not IS_CLANG_REPL) and (IS_MAC_ARM or IS_MAC_X86), reason="Fails on OS X Cling") + @mark.xfail(condition=IS_MAC and IS_CLING, reason="Fails on OS X Cling") def test01_size_mapping(self): """Use composites to map GetSize() onto buffer returns""" @@ -87,7 +87,7 @@ def set_size(self, buf): assert len(y) == bsize assert list(y) == list(map(lambda x: x*yval, range(bsize))) - @mark.xfail(condition=(not IS_CLANG_REPL) and (IS_MAC_ARM or IS_MAC_X86), reason="Fails on OS X Cling") + @mark.xfail(condition=IS_MAC and IS_CLING, reason="Fails on OS X Cling") def test02_size_mapping_of_templated_method(self): """Use composites to map GetSize() onto buffer returns""" @@ -111,7 +111,7 @@ def set_size(self, buf): assert len(y) == bsize assert list(y) == list(map(lambda x: x*yval, range(bsize))) - @mark.xfail(condition=IS_MAC and not IS_CLANG_REPL, reason="fails on OSX-Cling") + @mark.xfail(condition=IS_MAC and IS_CLING, reason="fails on OSX-Cling") def test03_type_pinning(self): """Verify pinnability of returns""" @@ -197,7 +197,7 @@ def test06_executors(self): assert mine.__smartptr__().get().m_check == 0xcdcdcdcd assert mine.say_hi() == "Hi!" - @mark.xfail(condition=(not IS_CLANG_REPL) and (IS_MAC_ARM or IS_MAC_X86), reason="Fails on OS X Cling") + @mark.xfail(condition=IS_MAC and IS_CLING, reason="Fails on OS X Cling") def test07_creates_flag(self): """Effect of creates flag on return type""" @@ -219,7 +219,7 @@ def test07_creates_flag(self): assert Countable.sInstances == oldcount - @mark.xfail(condition=(not IS_CLANG_REPL) and (IS_MAC_ARM or IS_MAC_X86), reason="Fails on OS X Cling") + @mark.xfail(condition=IS_MAC and IS_CLING, reason="Fails on OS X Cling") def test08_base_class_pythonization(self): """Derived class should not re-pythonize base class pythonization""" diff --git a/test/test_regression.py b/test/test_regression.py index 7d2742a1..a58b3791 100644 --- a/test/test_regression.py +++ b/test/test_regression.py @@ -1,6 +1,6 @@ import py, os, sys from pytest import raises, skip, mark -from .support import setup_make, IS_WINDOWS, ispypy, IS_CLANG_REPL, IS_CLANG_DEBUG, IS_MAC_X86, IS_MAC_ARM, IS_MAC +from .support import setup_make, IS_WINDOWS, ispypy, IS_CLANG_REPL, IS_CLING, IS_CLANG_DEBUG, IS_MAC_X86, IS_MAC_ARM, IS_MAC class TestREGRESSION: @@ -185,7 +185,7 @@ def test07_class_refcounting(self): assert sys.getrefcount(x) == old_refcnt - @mark.xfail(run=not((IS_MAC_ARM or IS_MAC_X86) and not IS_CLANG_REPL)) + @mark.xfail(run=not(IS_MAC and IS_CLING)) def test08_typedef_identity(self): """Nested typedefs should retain identity""" @@ -205,7 +205,7 @@ def test08_typedef_identity(self): assert not 'vector' in dir(PyABC.S2) assert PyABC.S2.S1_coll is cppyy.gbl.std.vector('const PyABC::S1*') - @mark.xfail(condition=(IS_MAC and not IS_CLANG_REPL), reason="fails on OSX-Cling") + @mark.xfail(condition=(IS_MAC and IS_CLING), reason="fails on OSX-Cling") def test09_gil_not_released(self): """GIL was released by accident for by-value returns""" @@ -228,7 +228,7 @@ def test09_gil_not_released(self): cppyy.cppdef(code) cppyy.gbl.some_foo_calling_python() - @mark.skipif(not IS_CLANG_REPL, reason="Crashes on Cling") + @mark.xfail(run = False, condition = IS_CLING, reason="Crashes on Cling") def test10_enum_in_global_space(self): """Enum declared in search.h did not appear in global space""" @@ -684,7 +684,7 @@ def test24_C_style_enum(self): CSE.your_enum = CSE.YourEnum.kFour assert CSE.your_enum == CSE.YourEnum.kFour - @mark.xfail(condition=IS_MAC and not IS_CLANG_REPL, reason="Fails with OSX-Cling") + @mark.xfail(condition=IS_MAC and IS_CLING, reason="Fails with OSX-Cling") def test25_const_iterator(self): """const_iterator failed to resolve the proper return type""" @@ -739,7 +739,7 @@ def test26_const_charptr_data(self): with raises(TypeError): io.BackendPlatformName = "aap" - @mark.xfail(condition=(not IS_CLANG_REPL) and (IS_MAC_ARM or IS_MAC_X86), reason="Fails on OS X Cling") + @mark.xfail(condition=IS_MAC and IS_CLING, reason="Fails on OS X Cling") def test27_exception_by_value(self): """Proper memory management of exception return by value""" @@ -775,7 +775,7 @@ class Countable : std::exception { gc.collect() assert ns.count() == 0 - @mark.xfail(condition=(not IS_CLANG_REPL) and (IS_MAC_ARM or IS_MAC_X86), reason="Fails on OS X Cling") + @mark.xfail(condition=IS_MAC and IS_CLING, reason="Fails on OS X Cling") def test28_exception_as_shared_ptr(self): """shared_ptr of an exception object null-checking""" @@ -791,7 +791,7 @@ def test28_exception_as_shared_ptr(self): null = cppyy.gbl.exception_as_shared_ptr.get_shared_null() assert not null - @mark.xfail(run=False, condition=(not IS_CLANG_REPL and IS_MAC) or IS_MAC_ARM, reason="Dispatcher fix #53 introduces canonical types with std:: namespace that introduces OS X exceptions similar to test_stltypes") + @mark.xfail(run=False, condition=(IS_CLING and IS_MAC) or IS_MAC_ARM, reason="Dispatcher fix #53 introduces canonical types with std:: namespace that introduces OS X exceptions similar to test_stltypes") def test29_callback_pointer_values(self): """Make sure pointer comparisons in callbacks work as expected""" @@ -1015,7 +1015,7 @@ def test34_print_empty_collection(self): v = cppyy.gbl.std.vector[int]() str(v) - @mark.xfail(run=IS_CLANG_REPL, condition=IS_MAC or not IS_CLANG_REPL, reason="Crashes on Cling") + @mark.xfail(run=IS_CLANG_REPL, condition=IS_MAC or IS_CLING, reason="Crashes on Cling") def test35_filesytem(self): """Static path object used to crash on destruction""" @@ -1063,7 +1063,6 @@ def test36_ctypes_sizeof(self): assert cppyy.sizeof(param) == ctypes.sizeof(param) - @mark.xfail def test37_array_of_pointers_argument(self): """Passing an array of pointers used to crash""" @@ -1089,7 +1088,7 @@ def test37_array_of_pointers_argument(self): assert cppyy.addressof(res) == cppyy.addressof(arr) - @mark.xfail(run=not((IS_MAC_ARM or IS_MAC_X86) and not IS_CLANG_REPL)) + @mark.xfail(run = False, condition = (IS_MAC and IS_CLING), reason = "Crashes on OS X Cling") def test38_char16_arrays(self): """Access to fixed-size char16 arrays as data members""" diff --git a/test/test_stltypes.py b/test/test_stltypes.py index 5232ba7d..8bad09be 100644 --- a/test/test_stltypes.py +++ b/test/test_stltypes.py @@ -1,7 +1,7 @@ # -*- coding: UTF-8 -*- import py, os, sys from pytest import raises, skip, mark -from .support import setup_make, pylong, pyunicode, maxvalue, ispypy, IS_CLANG_REPL, IS_CLANG_DEBUG, IS_MAC_X86, IS_MAC_ARM, IS_MAC +from .support import setup_make, pylong, pyunicode, maxvalue, ispypy, IS_CLANG_REPL, IS_CLING, IS_CLANG_DEBUG, IS_MAC_X86, IS_MAC_ARM, IS_MAC currpath = py.path.local(__file__).dirpath() test_dct = str(currpath.join("stltypesDict")) @@ -388,7 +388,7 @@ def test06_vector_indexing(self): assert v2[-1] == v[-2] assert v2[self.N-4] == v[-2] - @mark.xfail(condition=(IS_MAC and not IS_CLANG_REPL), run=not(IS_MAC and not IS_CLANG_REPL), reason="Crashes on OSX") + @mark.xfail(run=False, condition=(IS_MAC and IS_CLING), reason="Crashes on OSX Cling") def test07_vector_bool(self): """Usability of std::vector which can be a specialization""" @@ -407,7 +407,7 @@ def test07_vector_bool(self): assert len(vb[4:8]) == 4 assert list(vb[4:8]) == [False]*3+[True] - @mark.xfail(run=not((IS_MAC_ARM or IS_MAC_X86) and not IS_CLANG_REPL)) + @mark.xfail(run=not(IS_MAC and IS_CLING)) def test08_vector_enum(self): """Usability of std::vector<> of some enums""" @@ -442,7 +442,7 @@ def test09_vector_of_string(self): raises(TypeError, cppyy.gbl.std.vector["std::string"], "abc") - @mark.xfail + @mark.xfail(condition = (IS_MAC and IS_CLING), reason = "Fails on OS X Cling") def test10_vector_std_distance(self): """Use of std::distance with vector""" @@ -454,7 +454,7 @@ def test10_vector_std_distance(self): assert std.distance(v.begin(), v.end()) == v.size() assert std.distance[type(v).iterator](v.begin(), v.end()) == v.size() - @mark.xfail(condition=(IS_MAC and not IS_CLANG_REPL), reason="fails on OSX-Cling") + @mark.xfail(condition=(IS_MAC and IS_CLING), reason="fails on OSX-Cling") def test11_vector_of_pair(self): """Use of std::vector""" @@ -498,7 +498,7 @@ class PairVector { ll4[1] = 'a' raises(TypeError, a.vector_pair, ll4) - @mark.xfail(condition=(not IS_CLANG_REPL) and (IS_MAC_ARM or IS_MAC_X86), reason="Fails on OS X Cling") + @mark.xfail(condition=IS_MAC and IS_CLING, reason="Fails on OS X Cling") def test12_vector_lifeline(self): """Check lifeline setting on vectors of objects""" @@ -565,7 +565,7 @@ def test13_vector_smartptr_iteration(self): i += 1 assert i == len(result) - @mark.xfail(run=not((IS_MAC_ARM or IS_MAC_X86) and not IS_CLANG_REPL)) + @mark.xfail(run=not(IS_MAC and IS_CLING)) def test14_vector_of_vector_of_(self): """Nested vectors""" @@ -581,7 +581,7 @@ def test14_vector_of_vector_of_(self): assert vv[1][0] == 3 assert vv[1][1] == 4 - @mark.xfail(condition=not IS_CLANG_REPL and IS_MAC, reason="Fails on OS X Cling") + @mark.xfail(condition=IS_MAC and IS_CLING, reason="Fails on OS X Cling") def test15_vector_slicing(self): """Advanced test of vector slicing""" @@ -608,7 +608,7 @@ def test15_vector_slicing(self): # additional test from CPython's test suite getslice_cpython_test(vector[int]) - @mark.xfail(condition=not IS_CLANG_REPL and IS_MAC, reason="Fails on OS X Cling") + @mark.xfail(condition=IS_MAC and IS_CLING, reason="Fails on OS X Cling") def test16_vector_construction(self): """Vector construction following CPython's sequence""" @@ -625,7 +625,7 @@ def test17_vector_cpp17_style(self): v = cppyy.gbl.std.vector(l) assert list(l) == l - @mark.xfail(run=not((IS_MAC_ARM or IS_MAC_X86) and not IS_CLANG_REPL)) + @mark.xfail(run=not(IS_MAC and IS_CLING)) def test18_array_interface(self): """Test usage of __array__ from numpy""" @@ -672,7 +672,7 @@ def test18_array_interface(self): v = np.array(v, dtype=np.intc) assert ns.func(v) == sum(v) - @mark.xfail(condition=IS_MAC and not IS_CLANG_REPL, run=False, reason="Crashes with OSX-Cling") + @mark.xfail(condition=IS_MAC and IS_CLING, run=False, reason="Crashes with OSX-Cling") def test19_vector_point3d(self): """Iteration over a vector of by-value objects""" @@ -704,7 +704,7 @@ class Point3D { assert cppsum == pysum - @mark.xfail(condition=(not IS_CLANG_REPL) and (IS_MAC_ARM or IS_MAC_X86), reason="Fails on OS X Cling") + @mark.xfail(condition=IS_MAC and IS_CLING, reason="Fails on OS X Cling") def test20_vector_cstring(self): """Usage of a vector of const char*""" @@ -1039,7 +1039,7 @@ def setup_class(cls): cls.stltypes = cppyy.load_reflection_info(cls.test_dct) cls.N = 13 - @mark.xfail(condition=IS_MAC and not IS_CLANG_REPL, reason="Fails with OSX-Cling") + @mark.xfail(condition=IS_MAC and IS_CLING, reason="Fails with OSX-Cling") def test01_builtin_list_type(self): """Test access to a list""" @@ -1077,7 +1077,7 @@ def test01_builtin_list_type(self): for val in a: assert ll[ll.index(val)] == val - @mark.xfail(condition=IS_MAC and not IS_CLANG_REPL, reason="Fails with OSX-Cling") + @mark.xfail(condition=IS_MAC and IS_CLING, reason="Fails with OSX-Cling") def test02_empty_list_type(self): """Test behavior of empty list""" @@ -1089,7 +1089,7 @@ def test02_empty_list_type(self): for arg in a: pass - @mark.xfail(condition=not IS_CLANG_REPL and IS_MAC, reason="Fails on OSX with cling") + @mark.xfail(condition=IS_MAC and IS_CLING, reason="Fails on OSX with cling") def test03_replacement_of_eq(self): """A global templated function should work as a method""" @@ -1128,7 +1128,7 @@ def test04_iter_of_iter(self): assert a == i i += 1 - @mark.xfail + @mark.xfail(run=not(IS_MAC and IS_CLING)) def test05_list_cpp17_style(self): """C++17 style initialization of std::list""" @@ -1161,7 +1161,7 @@ def setup_class(cls): cls.stltypes = cppyy.load_reflection_info(cls.test_dct) cls.N = 13 - @mark.xfail(condition=not IS_MAC or not IS_CLANG_REPL, reason="Fails on Ubuntu and OSX-cling") + @mark.xfail(condition=not IS_MAC or IS_CLING, reason="Fails on Ubuntu and OSX-cling") def test01_builtin_map_type(self): """Test access to a map""" @@ -1217,7 +1217,7 @@ def test02_keyed_maptype(self): assert len(a) == self.N - @mark.xfail(condition=(not IS_CLANG_REPL) and (IS_MAC_ARM or IS_MAC_X86), reason="Fails on OS X Cling") + @mark.xfail(condition=IS_MAC and IS_CLING, reason="Fails on OS X Cling") def test03_empty_maptype(self): """Test behavior of empty map""" @@ -1346,7 +1346,7 @@ def setup_class(cls): import cppyy cls.stltypes = cppyy.load_reflection_info(cls.test_dct) - @mark.xfail(condition=not IS_CLANG_REPL and IS_MAC, reason="Fails on OS X Cling") + @mark.xfail(condition=IS_MAC and IS_CLING, reason="Fails on OS X Cling") def test01_builtin_vector_iterators(self): """Test iterator comparison with operator== reflected""" @@ -1522,7 +1522,7 @@ def test01_array_of_basic_types(self): a[i] = i assert a[i] == i - @mark.xfail(condition=(IS_MAC and not IS_CLANG_REPL), reason="fails on OSX-Cling") + @mark.xfail(condition=(IS_MAC and IS_CLING), reason="fails on OSX-Cling") def test02_array_of_pods(self): """Usage of std::array of PODs""" @@ -1546,7 +1546,7 @@ def test02_array_of_pods(self): assert a[2].px == 6 assert a[2].py == 7 - @mark.xfail(condition=(IS_MAC and not IS_CLANG_REPL), reason="fails on OSX-Cling") + @mark.xfail(condition=(IS_MAC and IS_CLING), reason="fails on OSX-Cling") def test03_array_of_pointer_to_pods(self): """Usage of std::array of pointer to PODs""" @@ -1666,7 +1666,7 @@ def setup_class(cls): cls.stltypes = cppyy.load_reflection_info(cls.test_dct) cls.N = cppyy.gbl.N - @mark.xfail(condition=(not IS_CLANG_REPL) and (IS_MAC_ARM or IS_MAC_X86), reason="Fails on OS X Cling") + @mark.xfail(condition=IS_MAC and IS_CLING, reason="Fails on OS X Cling") def test01_deque_byvalue_regression(self): """Return by value of a deque used to crash""" @@ -1677,7 +1677,7 @@ def test01_deque_byvalue_regression(self): assert x del x - @mark.xfail + @mark.xfail(run = not(IS_MAC and IS_CLING), reason="Crashes on OS X Cling") def test02_deque_cpp17_style(self): """C++17 style initialization of std::deque""" @@ -1695,7 +1695,7 @@ def setup_class(cls): cls.stltypes = cppyy.load_reflection_info(cls.test_dct) cls.N = cppyy.gbl.N - @mark.xfail(condition=IS_MAC and not IS_CLANG_REPL, reason="Fails with OSX-Cling") + @mark.xfail(condition=IS_MAC and IS_CLING, reason="Fails with OSX-Cling") def test01_set_iteration(self): """Iterate over a set""" @@ -1713,7 +1713,7 @@ def test01_set_iteration(self): assert i in s assert i in r - @mark.xfail(condition=IS_MAC and not IS_CLANG_REPL, reason="Fails on OS X Cling") + @mark.xfail(condition=IS_MAC and IS_CLING, reason="Fails on OS X Cling") def test02_set_iterators(self): """Access to set iterators and their comparisons""" @@ -1757,7 +1757,7 @@ def test03_initialize_from_set(self): with raises(TypeError): s = cppyy.gbl.std.set[int](set(["aap", "noot", "mies"])) - @mark.xfail + @mark.xfail(run=not(IS_MAC and IS_CLING)) def test04_set_cpp17_style(self): """C++17 style initialization of std::set""" @@ -1887,7 +1887,7 @@ def setup_class(cls): cls.stltypes = cppyy.load_reflection_info(cls.test_dct) cls.N = cppyy.gbl.N - @mark.xfail(condition=(IS_MAC and not IS_CLANG_REPL), reason="fails on OSX-Cling") + @mark.xfail(condition=(IS_MAC and IS_CLING), reason="fails on OSX-Cling") def test01_pair_pack_unpack(self): """Pack/unpack pairs""" @@ -1907,7 +1907,7 @@ def setup_class(cls): import cppyy cls.stltypes = cppyy.load_reflection_info(cls.test_dct) - @mark.xfail(condition=(IS_MAC and not IS_CLANG_REPL), reason="fails on OSX-Cling") + @mark.xfail(condition=(IS_MAC and IS_CLING), reason="fails on OSX-Cling") def test01_basics(self): """Test behavior of std::exception derived classes""" @@ -2030,7 +2030,7 @@ def run_raiseit(t1, t2): gc.collect() assert cppyy.gbl.GetMyErrorCount() == 0 - @mark.xfail(condition=(IS_MAC_X86 and not IS_CLANG_REPL) or IS_MAC_ARM, run=not IS_MAC_ARM, reason="Seg Faults") + @mark.xfail(condition=(IS_MAC_X86 and IS_CLING) or IS_MAC_ARM, run=not IS_MAC_ARM, reason="Seg Faults") def test04_from_cpp(self): """Catch C++ exceptiosn from C++""" diff --git a/test/test_templates.py b/test/test_templates.py index 0fd32fad..0a418e27 100644 --- a/test/test_templates.py +++ b/test/test_templates.py @@ -1,6 +1,6 @@ import py, os from pytest import raises, mark -from .support import setup_make, pylong, IS_CLANG_REPL, IS_CLANG_DEBUG, IS_MAC_X86, IS_MAC_ARM, IS_MAC +from .support import setup_make, pylong, IS_CLANG_REPL, IS_CLING, IS_CLANG_DEBUG, IS_MAC_X86, IS_MAC_ARM, IS_MAC, IS_LINUX currpath = py.path.local(__file__).dirpath() test_dct = str(currpath.join("templatesDict")) @@ -125,7 +125,7 @@ def test03_templated_function(self): assert type(ggsr(vector['int']([5])).m_retval) == int assert ggsr(vector['int']([5])).m_retval == 5 - @mark.xfail + @mark.xfail(condition = IS_MAC, reason = "Fails on OS X") def test04_variadic_function(self): """Call a variadic function""" @@ -145,7 +145,7 @@ def test04_variadic_function(self): assert cppyy.gbl.test04_variadic_func['int', 'double', 'void*']() == 3 - @mark.xfail(condition=not IS_CLANG_REPL, reason="Fails with Cling") + @mark.xfail(condition=IS_MAC and IS_CLING, reason="Fails with OSX Cling") def test05_variadic_overload(self): """Call an overloaded variadic function""" @@ -238,7 +238,7 @@ def test09_templated_callable(self): assert tc(5) == 5. - @mark.xfail(condition=(not IS_CLANG_REPL) and (IS_MAC_ARM or IS_MAC_X86), reason="Fails on OS X Cling") + @mark.xfail(condition=IS_MAC and IS_CLING, reason="Fails on OS X Cling") def test10_templated_hidding_methods(self): """Test that base class methods are not considered when hidden""" @@ -251,7 +251,6 @@ def test10_templated_hidding_methods(self): assert D().callme() == 2 assert D().callme(2) == 2 - @mark.xfail def test11_templated_ctor(self): """Test templated constructors""" @@ -317,7 +316,7 @@ def test12_template_aliases(self): assert nsup.Foo assert nsup.Bar.Foo # used to fail - @mark.xfail + @mark.xfail(condition = (IS_MAC and IS_CLING), reason = "Fails on OS X Cling") def test13_using_templated_method(self): """Access to base class templated methods through 'using'""" @@ -370,7 +369,7 @@ def test14_templated_return_type(self): assert rttest_make_tlist2(RTTest_SomeStruct1()) assert rttest_make_tlist2(RTTest_SomeNamespace.RTTest_SomeStruct2()) - @mark.xfail(condition=(IS_MAC and not IS_CLANG_REPL), reason="fails on OSX-Cling") + @mark.xfail(condition=(IS_MAC and IS_CLING), reason="fails on OSX-Cling") def test15_rvalue_templates(self): """Use of a template with r-values; should accept builtin types""" @@ -388,7 +387,7 @@ def test15_rvalue_templates(self): assert is_valid(1.) assert not is_valid(0.) - @mark.xfail + @mark.xfail(condition = IS_MAC, reason = "Fails on OS X") def test16_variadic(self): """Range of variadic templates""" @@ -477,7 +476,7 @@ def test18_greedy_overloads(self): assert g3.get_size(ns.SomeClass()) == cppyy.sizeof(ns.SomeClass) assert g3.get_size(cppyy.nullptr, True) == -1 - @mark.xfail + @mark.xfail(condition = IS_CLING, reason = "Fails on Cling") def test19_templated_operator_add(self): """Templated operator+ is ambiguous: either __pos__ or __add__""" @@ -507,7 +506,6 @@ class CustomVec { assert round(q.X() - 6.3, 8) == 0. - @mark.xfail def test20_templated_ctor_with_defaults(self): """Templated constructor with defaults used to be ignored""" @@ -524,7 +522,7 @@ class C { assert cppyy.gbl.TemplatedCtor.C(0) - @mark.xfail(condition=(not IS_CLANG_REPL) and (IS_MAC_ARM or IS_MAC_X86), reason="Fails on OS X Cling") + @mark.xfail(condition=IS_MAC and IS_CLING, reason="Fails on OS X Cling") def test21_type_deduction_with_conversion(self): """Template instantiation with [] -> std::vector conversion""" @@ -578,7 +576,7 @@ def test22_type_deduction_of_proper_integer_size(self): for val in [2**64, -2**63-1]: raises(OverflowError, PassSomeInt, val) - @mark.xfail(condition=(not IS_CLANG_REPL) and (IS_MAC_ARM or IS_MAC_X86), reason="Fails on OS X Cling") + @mark.xfail(condition=IS_MAC and IS_CLING, reason="Fails on OS X Cling") def test23_overloaded_setitem(self): """Template with overloaded non-templated and templated setitem""" @@ -589,7 +587,7 @@ def test23_overloaded_setitem(self): v = MyVec["float"](2) v[0] = 1 # used to throw TypeError - @mark.xfail(run=not IS_CLANG_REPL, reason="Crashes in ClangRepl") + @mark.xfail(condition=IS_MAC and IS_CLING, reason="Fails on OS X Cling") def test24_stdfunction_templated_arguments(self): """Use of std::function with templated arguments""" @@ -616,7 +614,7 @@ def callback(x): assert cppyy.gbl.std.function['double(std::vector)'] - @mark.xfail(run=(IS_MAC_ARM or IS_MAC_X86) and IS_CLANG_REPL) + @mark.xfail(run=(IS_MAC and IS_CLANG_REPL)) def test25_stdfunction_ref_and_ptr_args(self): """Use of std::function with reference or pointer args""" @@ -683,7 +681,6 @@ def test25_stdfunction_ref_and_ptr_args(self): foo.fnc = ns.bar foo.fnc # <- this access used to fail - @mark.xfail def test26_partial_templates(self): """Deduction of types with partial templates""" @@ -745,7 +742,7 @@ def test26_partial_templates(self): assert ns.bar2['double'](17) == 17 assert ns.bar2['double','int'](17) == 17 - @mark.xfail + @mark.xfail(condition=IS_MAC and IS_CLING, reason="Fails on OS X and Cling") def test27_variadic_constructor(self): """Use of variadic template function as contructor""" @@ -780,7 +777,7 @@ class Atom { a = ns.Atom(1567.0) assert a.m_m == 1567.0 - @mark.xfail + @mark.xfail(condition = IS_MAC, reason = "Fails on OS X ") def test28_enum_in_constructor(self): """Use of enums in template function as constructor""" @@ -1124,7 +1121,7 @@ class TNaVU; run_n = getattr(cppyy.gbl, 'TNaRun_%d' % n) getattr(run_n, t) - @mark.xfail(run=not((IS_MAC_ARM or IS_MAC_X86) and not IS_CLANG_REPL)) + @mark.xfail(run=not(IS_MAC and IS_CLING), reason="Crashes on OS X + Cling") def test33_using_template_argument(self): """`using` type as template argument""" @@ -1179,7 +1176,7 @@ def test34_cstring_template_argument(self): assert ns.stringify(ctypes.c_char_p(bytes("Noot", "ascii"))) == "Noot " -@mark.skipif(((IS_MAC_ARM or IS_MAC_X86) and not IS_CLANG_REPL), reason="setup class fails with OS X cling") +@mark.skipif((IS_MAC and IS_CLING), reason="setup class fails with OS X cling") class TestTEMPLATED_TYPEDEFS: def setup_class(cls): cls.test_dct = test_dct @@ -1297,7 +1294,7 @@ class A { assert cppyy.gbl.FailedTypeDeducer.B[int]().result() == 5 -@mark.skipif(((IS_MAC_ARM or IS_MAC_X86) and not IS_CLANG_REPL), reason="setup class fails with OS X cling") +@mark.skipif((IS_MAC and IS_CLING), reason="setup class fails with OS X cling") class TestTEMPLATE_TYPE_REDUCTION: def setup_class(cls): cls.test_dct = test_dct