Skip to content

Commit 67a1af4

Browse files
committed
Simplify hard-to-read test tags with IS_CLING
1 parent eb0006f commit 67a1af4

13 files changed

+80
-79
lines changed

test/support.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,4 @@ def setup_make(targetname):
7373
#else
7474
true
7575
#endif\n""") == 1)
76+
IS_CLING = not IS_CLANG_REPL

test/test_conversions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import py, os, sys
22
from pytest import raises, mark
3-
from .support import setup_make
3+
from .support import setup_make, IS_LINUX, IS_CLANG_REPL, IS_CLING, IS_MAC
44

55
currpath = py.path.local(__file__).dirpath()
66
test_dct = str(currpath.join("conversionsDict"))
@@ -87,7 +87,7 @@ def test03_error_handling(self):
8787
gc.collect()
8888
assert CC.s_count == 0
8989

90-
@mark.xfail(condition = IS_MAC and IS_CLANG_REPL)
90+
@mark.xfail(run = not(IS_LINUX and IS_CLING), condition = ((IS_MAC and IS_CLANG_REPL) or (IS_LINUX and IS_CLING)), reason = "Fails on OS X + Clang-Repl, Crashes on Linux + Cling")
9191
def test04_implicit_conversion_from_tuple(self):
9292
"""Allow implicit conversions from tuples as arguments {}-like"""
9393

test/test_cpp11features.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import py, os, sys
22
from pytest import raises, mark
3-
from .support import setup_make, ispypy, IS_CLANG_REPL, IS_LINUX_ARM, IS_MAC
3+
from .support import setup_make, ispypy, IS_CLANG_REPL, IS_LINUX_ARM, IS_MAC, IS_CLING
44

55

66
currpath = py.path.local(__file__).dirpath()
@@ -433,7 +433,7 @@ def test14_shared_ptr_passing(self):
433433
gc.collect()
434434
assert TestSmartPtr.s_counter == 0
435435

436-
@mark.xfail(condition=(IS_MAC and not IS_CLANG_REPL), reason = "Fails on OS X Cling")
436+
@mark.xfail(condition=(IS_MAC and IS_CLING), reason = "Fails on OS X Cling")
437437
def test15_unique_ptr_template_deduction(self):
438438
"""Argument type deduction with std::unique_ptr"""
439439

test/test_crossinheritance.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1033,7 +1033,7 @@ def return_const(self):
10331033
assert a.return_const().m_value == "abcdef"
10341034
assert ns.callit(a).m_value == "abcdef"
10351035

1036-
@mark.xfail(condition = IS_MAC and IS_CLANG_REPL)
1036+
@mark.xfail(condition = IS_MAC and IS_CLANG_REPL, reason = "Fails on OS X Clang-REPL")
10371037
def test24_non_copyable(self):
10381038
"""Inheriting from a non-copyable base class"""
10391039

test/test_datatypes.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import py, os, sys
22
from pytest import raises, skip, mark
3-
from .support import setup_make, pylong, pyunicode, IS_CLANG_REPL, IS_MAC_X86, IS_MAC_ARM, IS_MAC, IS_LINUX
3+
from .support import setup_make, pylong, pyunicode, IS_CLANG_REPL, IS_CLING, IS_MAC_X86, IS_MAC_ARM, IS_MAC, IS_LINUX
44

55
IS_MAC = IS_MAC_X86 or IS_MAC_ARM
66

@@ -1643,7 +1643,7 @@ def test31_anonymous_union(self):
16431643
assert type(p.data_c[0]) == float
16441644
assert p.intensity == 5.
16451645

1646-
@mark.xfail(condition=not IS_CLANG_REPL, reason="Fails on Cling")
1646+
@mark.xfail(condition=IS_CLING, reason="Fails on Cling")
16471647
def test32_anonymous_struct(self):
16481648
"""Anonymous struct creates an unnamed type"""
16491649

@@ -2096,7 +2096,7 @@ def pycompdot(a, b, N):
20962096
Ccl = func(Acl, Bcl, 2)
20972097
assert complex(Ccl) == pyCcl
20982098

2099-
@mark.xfail(condition=(IS_MAC and not IS_CLANG_REPL), reason = "Fails on OS X Cling")
2099+
@mark.xfail(condition=(IS_MAC and IS_CLING), reason = "Fails on OS X Cling")
21002100
def test42_mixed_complex_arithmetic(self):
21012101
"""Mixin of Python and C++ std::complex in arithmetic"""
21022102

test/test_doc_features.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import py, os, sys
22
from pytest import raises, skip, mark
3-
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
3+
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
44

55
currpath = py.path.local(__file__).dirpath()
66
test_dct = str(currpath.join("doc_helperDict"))
@@ -9,7 +9,7 @@ def setup_module(mod):
99
setup_make("doc_helper")
1010

1111

12-
@mark.skipif((IS_MAC_ARM or IS_MAC_X86) and (not IS_CLANG_REPL), reason="setup class fails with OS X cling")
12+
@mark.skipif(IS_MAC and IS_CLING, reason="setup class fails with OS X cling")
1313
class TestDOCFEATURES:
1414
def setup_class(cls):
1515
cls.test_dct = test_dct
@@ -485,7 +485,7 @@ def test_exceptions(self):
485485
assert caught == True
486486

487487

488-
@mark.skipif((IS_MAC_ARM or IS_MAC_X86) and (not IS_CLANG_REPL), reason="setup class fails with OS X cling")
488+
@mark.skipif(IS_MAC and IS_CLING, reason="setup class fails with OS X cling")
489489
class TestTUTORIALFEATURES:
490490
def setup_class(cls):
491491
import cppyy
@@ -574,7 +574,7 @@ def test02_python_introspection(self):
574574
assert not isinstance(i, int)
575575
assert isinstance(i, Integer1)
576576

577-
@mark.xfail(run=(not IS_MAC and IS_CLANG_REPL), condition=IS_MAC and (not IS_CLANG_REPL), reason= "Crashes on OS X Cling")
577+
@mark.xfail(run=(not IS_MAC and IS_CLANG_REPL), condition=IS_MAC and IS_CLING, reason= "Crashes on OS X Cling")
578578
def test03_STL_containers(self):
579579
"""Instantiate STL containers with new class"""
580580

@@ -612,7 +612,7 @@ def pythonizor(klass, name):
612612
i2 = Integer2(13)
613613
assert int(i2) == 13
614614

615-
@mark.xfail(condition=IS_MAC and not IS_CLANG_REPL, reason="Fails on OSX Cling")
615+
@mark.xfail(condition=IS_MAC and IS_CLING, reason="Fails on OSX Cling")
616616
def test06_add_operator(self):
617617
"""Add operator+"""
618618

@@ -735,7 +735,7 @@ def test10_stl_algorithm(self):
735735
assert n == 'thisisaC++stringing'
736736

737737

738-
@mark.skipif((IS_MAC_ARM or IS_MAC_X86) and (not IS_CLANG_REPL), reason="setup class fails with OS X cling")
738+
@mark.skipif(IS_MAC and IS_CLING, reason="setup class fails with OS X cling")
739739
class TestADVERTISED:
740740
def setup_class(cls):
741741
import cppyy
@@ -850,7 +850,7 @@ def test03_use_of_ctypes_and_enum(self):
850850
assert list(arr) == [1, 42, 1, 42]
851851
cppyy.gbl.free(vp)
852852

853-
@mark.xfail(run=(not IS_MAC and IS_CLANG_REPL), condition=IS_MAC and (not IS_CLANG_REPL), reason= "Crashes on OS X Cling")
853+
@mark.xfail(run=(not IS_MAC and IS_CLANG_REPL), condition=IS_MAC and IS_CLING, reason= "Crashes on OS X Cling")
854854
def test04_ptr_ptr_python_owns(self):
855855
"""Example of ptr-ptr use where python owns"""
856856

@@ -1074,7 +1074,7 @@ def produce_imp(self):
10741074

10751075
# The series of tests below mostly exists already in other places, but these
10761076
# were used as examples for the CaaS' cppyy presentation and are preserved here.
1077-
@mark.skipif((IS_MAC_ARM or IS_MAC_X86) and (not IS_CLANG_REPL), reason="setup class fails with OS X cling")
1077+
@mark.skipif(IS_MAC and IS_CLING, reason="setup class fails with OS X cling")
10781078
class TestTALKEXAMPLES:
10791079
def setup_class(cls):
10801080
import cppyy

test/test_eigen.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import py, os, sys
22
from pytest import mark, raises
3-
from .support import setup_make, IS_CLANG_REPL, IS_MAC_X86
3+
from .support import setup_make, IS_CLANG_REPL, IS_CLING, IS_MAC_X86
44

55
inc_paths = [os.path.join(os.path.sep, 'usr', 'include'),
66
os.path.join(os.path.sep, 'usr', 'local', 'include')]
@@ -158,7 +158,7 @@ def setup_class(cls):
158158
warnings.simplefilter('ignore')
159159
cppyy.include('Eigen/Dense')
160160

161-
@mark.xfail(condition=IS_MAC_X86 and (not IS_CLANG_REPL), reason="Errors out on OS X Cling")
161+
@mark.xfail(condition=IS_MAC_X86 and IS_CLING, reason="Errors out on OS X Cling")
162162
def test01_use_of_Map(self):
163163
"""Use of Map (used to crash)"""
164164

test/test_operators.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import py, os, sys
22
from pytest import raises, skip, mark
3-
from .support import setup_make, pylong, maxvalue, IS_WINDOWS, IS_MAC, IS_CLANG_REPL
3+
from .support import setup_make, pylong, maxvalue, IS_WINDOWS, IS_MAC, IS_CLANG_REPL, IS_CLING
44

55
currpath = py.path.local(__file__).dirpath()
66
test_dct = str(currpath.join("operatorsDict"))
@@ -337,7 +337,7 @@ def test14_single_argument_call(self):
337337
b = ns.Bar()
338338
assert b[42] == 42
339339

340-
@mark.xfail(condition = (IS_MAC and not IS_CLANG_REPL), reason = "Fails on OS X Cling")
340+
@mark.xfail(condition = (IS_MAC and IS_CLING), reason = "Fails on OS X Cling")
341341
def test15_class_and_global_mix(self):
342342
"""Iterator methods have both class and global overloads"""
343343

test/test_pythonify.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import py, os, sys
22
from pytest import raises, skip, mark
3-
from .support import setup_make, pylong, ispypy, IS_CLANG_REPL, IS_MAC_ARM, IS_MAC_X86, IS_MAC
3+
from .support import setup_make, pylong, ispypy, IS_CLANG_REPL, IS_CLING, IS_MAC_ARM, IS_MAC_X86, IS_MAC
44

55
currpath = py.path.local(__file__).dirpath()
66
test_dct = str(currpath.join("example01Dict"))
@@ -379,7 +379,7 @@ def __init__(self, what):
379379

380380
assert example01.getCount() == 0
381381

382-
@mark.xfail(condition=(not IS_CLANG_REPL) and (IS_MAC_ARM or IS_MAC_X86), reason="Fails on OS X Cling")
382+
@mark.xfail(condition = IS_MAC and IS_CLING, reason = "Fails on OS X Cling")
383383
def test17_chaining(self):
384384
"""Respective return values of temporaries should not go away"""
385385

@@ -496,7 +496,7 @@ def verify_b(b, val, ti, to):
496496
with raises(TypeError):
497497
c.callme(a=1, b=2)
498498

499-
@mark.xfail(condition=(not IS_CLANG_REPL) or IS_MAC, reason="Fails on Cling and OSX")
499+
@mark.xfail(condition=IS_MAC or IS_CLING, reason="Fails on Cling and OSX")
500500
def test19_keywords_and_defaults(self):
501501
"""Use of keyword arguments mixed with defaults"""
502502

test/test_pythonization.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import py, os, sys
22
from pytest import raises, mark
3-
from .support import setup_make, pylong, IS_MAC_X86, IS_MAC_ARM, IS_MAC, IS_CLANG_REPL
3+
from .support import setup_make, pylong, IS_MAC_X86, IS_MAC_ARM, IS_MAC, IS_CLANG_REPL, IS_CLING
44

55
currpath = py.path.local(__file__).dirpath()
66
test_dct = str(currpath.join("pythonizablesDict"))
@@ -63,7 +63,7 @@ def root_pythonizor(klass, name):
6363

6464
assert len(cppyy.gbl.CppyyLegacy.TObjString("aap")) == 4 # include '\0'
6565

66-
@mark.xfail(condition=(not IS_CLANG_REPL) and (IS_MAC_ARM or IS_MAC_X86), reason="Fails on OS X Cling")
66+
@mark.xfail(condition=IS_MAC and IS_CLING, reason="Fails on OS X Cling")
6767
def test01_size_mapping(self):
6868
"""Use composites to map GetSize() onto buffer returns"""
6969

@@ -87,7 +87,7 @@ def set_size(self, buf):
8787
assert len(y) == bsize
8888
assert list(y) == list(map(lambda x: x*yval, range(bsize)))
8989

90-
@mark.xfail(condition=(not IS_CLANG_REPL) and (IS_MAC_ARM or IS_MAC_X86), reason="Fails on OS X Cling")
90+
@mark.xfail(condition=IS_MAC and IS_CLING, reason="Fails on OS X Cling")
9191
def test02_size_mapping_of_templated_method(self):
9292
"""Use composites to map GetSize() onto buffer returns"""
9393

@@ -111,7 +111,7 @@ def set_size(self, buf):
111111
assert len(y) == bsize
112112
assert list(y) == list(map(lambda x: x*yval, range(bsize)))
113113

114-
@mark.xfail(condition=IS_MAC and not IS_CLANG_REPL, reason="fails on OSX-Cling")
114+
@mark.xfail(condition=IS_MAC and IS_CLING, reason="fails on OSX-Cling")
115115
def test03_type_pinning(self):
116116
"""Verify pinnability of returns"""
117117

@@ -197,7 +197,7 @@ def test06_executors(self):
197197
assert mine.__smartptr__().get().m_check == 0xcdcdcdcd
198198
assert mine.say_hi() == "Hi!"
199199

200-
@mark.xfail(condition=(not IS_CLANG_REPL) and (IS_MAC_ARM or IS_MAC_X86), reason="Fails on OS X Cling")
200+
@mark.xfail(condition=IS_MAC and IS_CLING, reason="Fails on OS X Cling")
201201
def test07_creates_flag(self):
202202
"""Effect of creates flag on return type"""
203203

@@ -219,7 +219,7 @@ def test07_creates_flag(self):
219219

220220
assert Countable.sInstances == oldcount
221221

222-
@mark.xfail(condition=(not IS_CLANG_REPL) and (IS_MAC_ARM or IS_MAC_X86), reason="Fails on OS X Cling")
222+
@mark.xfail(condition=IS_MAC and IS_CLING, reason="Fails on OS X Cling")
223223
def test08_base_class_pythonization(self):
224224
"""Derived class should not re-pythonize base class pythonization"""
225225

0 commit comments

Comments
 (0)