Skip to content

Commit 49a5dec

Browse files
committed
[roottest] Remove remnants of legacy_pyroot from tests
The so-called `legacy_pyroot` is not available for a long time anymore, and remnants of it should be deleted from the tests.
1 parent b5ac9cd commit 49a5dec

28 files changed

+240
-652
lines changed

roottest/python/CMakeLists.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
11
if(ROOT_pyroot_FOUND)
2-
if (ROOT_pyroot_legacy_FOUND)
3-
set(legacy_pyroot True)
4-
else()
5-
set(legacy_pyroot False)
6-
endif()
72

83
if(ROOT_roofit_FOUND)
94
set(roofit True)

roottest/python/basic/CMakeLists.txt

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,15 @@ if(ROOT_pyroot_FOUND)
22
ROOTTEST_ADD_TEST(basic
33
MACRO PyROOT_basictests.py
44
COPY_TO_BUILDDIR ArgumentPassingCompiled.C ReturnValues.C SimpleClass.C ArgumentPassingInterpreted.C
5-
PRECMD ${ROOT_root_CMD} -b -q -l -e .L\ ArgumentPassingCompiled.C+
6-
ENVIRONMENT LEGACY_PYROOT=${legacy_pyroot})
5+
PRECMD ${ROOT_root_CMD} -b -q -l -e .L\ ArgumentPassingCompiled.C+)
76

87
if(NOT MSVC OR win_broken_tests)
98
ROOTTEST_ADD_TEST(datatype
109
MACRO PyROOT_datatypetest.py
1110
COPY_TO_BUILDDIR DataTypes.C DataTypes.h
1211
PRECMD ${ROOT_root_CMD} -b -q -l -e .L\ DataTypes.C+
1312
ENVIRONMENT CLING_STANDARD_PCH=none
14-
CPPYY_BACKEND_LIBRARY=${CMAKE_BINARY_DIR}/lib/libcppyy_backend.so
15-
ENVIRONMENT LEGACY_PYROOT=${legacy_pyroot})
13+
CPPYY_BACKEND_LIBRARY=${CMAKE_BINARY_DIR}/lib/libcppyy_backend.so)
1614
endif()
1715

1816
ROOTTEST_ADD_TEST(operator
@@ -26,7 +24,6 @@ if(NOT MSVC OR win_broken_tests)
2624
COPY_TO_BUILDDIR Overloads.C Overloads.h
2725
PRECMD ${ROOT_root_CMD} -b -q -l -e .L\ Overloads.C+
2826
ENVIRONMENT CLING_STANDARD_PCH=none
29-
CPPYY_BACKEND_LIBRARY=${CMAKE_BINARY_DIR}/lib/libcppyy_backend.so
30-
ENVIRONMENT LEGACY_PYROOT=${legacy_pyroot})
27+
CPPYY_BACKEND_LIBRARY=${CMAKE_BINARY_DIR}/lib/libcppyy_backend.so)
3128
endif()
3229
endif()

roottest/python/basic/PyROOT_basictests.py

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -258,10 +258,6 @@ def test9ByRefPassing( self ):
258258

259259
### basic extension features test cases ======================================
260260
class Basic5PythonizationTestCase( MyTestCase ):
261-
@classmethod
262-
def setUpClass(cls):
263-
cls.legacy_pyroot = os.environ.get('LEGACY_PYROOT') == 'True'
264-
265261
def test1Strings( self ):
266262
"""Test string/TString/TObjString compatibility"""
267263

@@ -346,20 +342,17 @@ def make_obj_str(s):
346342
l.insert( 3, make_obj_str('6') )
347343
l.insert( 20, make_obj_str('7') )
348344
l.insert( -1, make_obj_str('8') )
349-
if not self.legacy_pyroot:
350-
# The pythonisation of TSeqCollection in experimental PyROOT mimics the
351-
# behaviour of the Python list, in this case for insert.
352-
# The Python list insert always inserts before the specified index, so if
353-
# -1 is specified, insert will place the new element right before the last
354-
# element of the list.
355-
self.assertEqual(list(l), ['a', 'b', '1', '6', '2', 'i', 'j', '3', '4', '5', 'j', '8', '7'])
356-
# Re-synchronize with current PyROOT's list
357-
l.insert(0, make_obj_str('8'))
358-
self.assertEqual(list(l), ['8', 'a', 'b', '1', '6', '2', 'i', 'j', '3', '4', '5', 'j', '8', '7'])
359-
l.pop(-2)
360-
self.assertEqual(list(l), ['8', 'a', 'b', '1', '6', '2', 'i', 'j', '3', '4', '5', 'j', '7'])
361-
else:
362-
self.assertEqual(list(l), ['8', 'a', 'b', '1', '6', '2', 'i', 'j', '3', '4', '5', 'j', '7'])
345+
# The pythonisation of TSeqCollection in experimental PyROOT mimics the
346+
# behaviour of the Python list, in this case for insert.
347+
# The Python list insert always inserts before the specified index, so if
348+
# -1 is specified, insert will place the new element right before the last
349+
# element of the list.
350+
self.assertEqual(list(l), ['a', 'b', '1', '6', '2', 'i', 'j', '3', '4', '5', 'j', '8', '7'])
351+
# Re-synchronize with current PyROOT's list
352+
l.insert(0, make_obj_str('8'))
353+
self.assertEqual(list(l), ['8', 'a', 'b', '1', '6', '2', 'i', 'j', '3', '4', '5', 'j', '8', '7'])
354+
l.pop(-2)
355+
self.assertEqual(list(l), ['8', 'a', 'b', '1', '6', '2', 'i', 'j', '3', '4', '5', 'j', '7'])
363356
self.assertEqual( l.pop(), '7' )
364357
self.assertEqual( l.pop(3), '1' )
365358
self.assertEqual( list(l), ['8', 'a', 'b', '6', '2', 'i', 'j', '3', '4', '5', 'j'] )

roottest/python/basic/PyROOT_datatypetest.py

Lines changed: 17 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,10 @@ def setup_class(cls):
3838
cls.test_dct = "DataTypes_C"
3939
cls.datatypes = cppyy.load_reflection_info(cls.test_dct)
4040
cls.N = cppyy.gbl.N
41-
cls.legacy_pyroot = os.environ.get('LEGACY_PYROOT') == 'True'
42-
if not cls.legacy_pyroot:
43-
# In new Cppyy, nullptr can't be found in gbl.
44-
# Take it from libcppyy (we could also use ROOT.nullptr)
45-
import libcppyy
46-
cls.nullptr = libcppyy.nullptr
47-
else:
48-
cls.nullptr = cppyy.gbl.nullptr
41+
# In new Cppyy, nullptr can't be found in gbl.
42+
# Take it from libcppyy (we could also use ROOT.nullptr)
43+
import libcppyy
44+
cls.nullptr = libcppyy.nullptr
4945

5046
def test01_load_reflection_cache(self):
5147
"""Loading reflection info twice should result in the same object"""
@@ -202,13 +198,9 @@ def test03_instance_data_write_access(self):
202198
c.set_uchar(45); assert c.m_uchar == chr(45)
203199

204200
# limits and checks
205-
if not self.legacy_pyroot:
206-
# This throws ValueError in new Cppyy
207-
raises(ValueError, c.set_char, "string")
208-
raises(ValueError, c.set_uchar, "string")
209-
else:
210-
raises(TypeError, c.set_char, "string")
211-
raises(TypeError, c.set_uchar, "string")
201+
# This throws ValueError in new Cppyy
202+
raises(ValueError, c.set_char, "string")
203+
raises(ValueError, c.set_uchar, "string")
212204
raises(ValueError, c.set_char, 500)
213205
raises(ValueError, c.set_uchar, -1)
214206
c.set_char_cr(-128); assert c.get_char() == chr(0x80)
@@ -807,11 +799,8 @@ def test16_nullptr_passing(self):
807799

808800
import cppyy
809801

810-
if not self.legacy_pyroot:
811-
# New Cppyy does not allow conversion from None to null pointer anymore
812-
t = (0, )
813-
else:
814-
t = (0, None)
802+
# New Cppyy does not allow conversion from None to null pointer anymore
803+
t = (0, )
815804
for o in t:
816805
c = cppyy.gbl.CppyyTestData()
817806
assert c.m_pod.m_int == 888
@@ -904,28 +893,14 @@ def test20_buffer_reshaping(self):
904893
if not PYTEST_MIGRATION:
905894
arr = arr.shape.fromaddress(arr.itemaddress(0), self.N)
906895
if PYTEST_MIGRATION:
907-
if not self.legacy_pyroot:
908-
# In new Cppyy, buffers have a reshape method
909-
arr.reshape((self.N,))
896+
# In new Cppyy, buffers have a reshape method
897+
arr.reshape((self.N,))
910898

911-
assert len(arr) == self.N
899+
assert len(arr) == self.N
912900

913-
l = list(arr)
914-
for i in range(self.N):
915-
assert arr[i] == l[i]
916-
else:
917-
arr.SetSize(self.N)
918-
# Test forward compatibility
919-
arr2 = getattr(c, func)()
920-
arr2.reshape((self.N,))
921-
922-
for a in arr,arr2:
923-
924-
assert len(a) == self.N
925-
926-
l = list(a)
927-
for i in range(self.N):
928-
assert a[i] == l[i]
901+
l = list(arr)
902+
for i in range(self.N):
903+
assert arr[i] == l[i]
929904

930905
def test21_voidp(self):
931906
"""Use of void* data"""
@@ -973,11 +948,8 @@ def address_equality_test(a, b):
973948
def null_test(null):
974949
c.m_voidp = null
975950
assert c.m_voidp is self.nullptr
976-
if not self.legacy_pyroot:
977-
# New Cppyy does not allow assignment of pointer type to None
978-
null_list = [0, self.nullptr]
979-
else:
980-
null_list = [0, None, self.nullptr]
951+
# New Cppyy does not allow assignment of pointer type to None
952+
null_list = [0, self.nullptr]
981953
map(null_test, null_list)
982954

983955
c.m_voidp = c2

roottest/python/basic/PyROOT_overloadtests.py

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ def setup_class(cls):
3232
import cppyy
3333
cls.test_dct = "Overloads_C"
3434
cls.datatypes = cppyy.load_reflection_info(cls.test_dct)
35-
cls.legacy_pyroot = os.environ.get('LEGACY_PYROOT') == 'True'
3635

3736
def test01_class_based_overloads(self):
3837
"""Functions overloaded on different C++ class arguments"""
@@ -103,21 +102,13 @@ def test03_fragile_class_based_overloads(self):
103102
from cppyy.gbl import get_OlBB, get_OlDD
104103

105104
# first verify that BB and DD are indeed unknown
106-
if not self.legacy_pyroot:
107-
# In new Cppyy, this raises a TypeError
108-
raises(TypeError, OlBB)
109-
raises(TypeError, OlDD)
110-
else:
111-
raises(RuntimeError, OlBB)
112-
raises(RuntimeError, OlDD)
105+
raises(TypeError, OlBB)
106+
raises(TypeError, OlDD)
113107

114108
# then try overloads based on them
115109
assert MoreOverloads().call(OlAA()) == "OlAA"
116-
if not self.legacy_pyroot:
117-
# New Cppyy calls the same overload as C++: (const OlBB&, void*)
118-
get_olbb_res = "OlBB"
119-
else:
120-
get_olbb_res = "OlDD" # <- has an unknown + void*
110+
# New Cppyy calls the same overload as C++: (const OlBB&, void*)
111+
get_olbb_res = "OlBB"
121112
assert MoreOverloads().call(get_OlBB()) == get_olbb_res
122113
assert MoreOverloads().call(OlCC()) == "OlCC"
123114
assert MoreOverloads().call(get_OlDD()) == "OlDD" # <- has an unknown

roottest/python/cling/CMakeLists.txt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
if(ROOT_pyroot_FOUND)
2-
if (ROOT_pyroot_legacy_FOUND)
3-
set(api_macro_file runPyAPITest.C)
4-
else()
5-
set(api_macro_file runPyAPITestCppyy.C) # Uses new Cppyy API
6-
endif()
2+
set(api_macro_file runPyAPITestCppyy.C) # Uses new Cppyy API
73
ROOTTEST_ADD_TEST(api
84
MACRO ${api_macro_file}
95
WORKING_DIR ${CMAKE_CURRENT_SOURCE_DIR}

roottest/python/cling/runPyAPITest.C

Lines changed: 0 additions & 17 deletions
This file was deleted.

roottest/python/cpp/CMakeLists.txt

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,18 @@ if(NOT MSVC OR win_broken_tests)
55
COPY_TO_BUILDDIR Namespace.C PointerPassing.C Namespace2.C
66
PRECMD ${ROOT_root_CMD} -b -q -l -e .L\ Namespace.C+
77
-e .L\ PointerPassing.C+
8-
-e .L\ Namespace2.C+
9-
ENVIRONMENT LEGACY_PYROOT=${legacy_pyroot})
8+
-e .L\ Namespace2.C+)
109

1110
ROOTTEST_ADD_TEST(advanced
1211
MACRO PyROOT_advancedtests.py
1312
COPY_TO_BUILDDIR AdvancedCpp.C Template.C
1413
PRECMD ${ROOT_root_CMD} -b -q -l -e .L\ AdvancedCpp.C+
15-
-e .L\ Template.C+
16-
ENVIRONMENT LEGACY_PYROOT=${legacy_pyroot})
14+
-e .L\ Template.C+)
1715
endif()
1816

1917
ROOTTEST_ADD_TEST(cpp11
2018
MACRO PyROOT_cpp11tests.py
2119
COPY_TO_BUILDDIR Cpp11Features.C
22-
PRECMD ${ROOT_root_CMD} -b -q -l -e .L\ Cpp11Features.C+
23-
ENVIRONMENT LEGACY_PYROOT=${legacy_pyroot})
20+
PRECMD ${ROOT_root_CMD} -b -q -l -e .L\ Cpp11Features.C+)
2421

2522
endif()

0 commit comments

Comments
 (0)