Skip to content

Commit 905b342

Browse files
committed
Make tests Py3-compatible
1 parent 400f3db commit 905b342

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+361
-333
lines changed

.travis.yml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,26 @@
1+
# -*- python -*-
2+
#
3+
# Copyright (c) 2016 Stefan Seefeld
4+
# All rights reserved.
5+
#
6+
# Distributed under the Boost Software License, Version 1.0.
7+
# (See accompanying file LICENSE_1_0.txt or copy at
8+
# http://www.boost.org/LICENSE_1_0.txt)
9+
110
language: cpp
11+
12+
env:
13+
- PYTHON=python
14+
- PYTHON=python3
15+
216
compiler:
317
- gcc
418

519
before_install:
6-
- sudo apt-get install -y python-dev
20+
- sudo apt-get install -y python-dev python-pip
21+
- sudo pip install future
22+
- sudo apt-get install -y python3-dev
723
- sudo apt-get install -y libboost-all-dev
824

9-
script: scons config && scons && scons test
25+
script: scons config --python=$PYTHON && scons && scons test
1026

test/Jamfile.v2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ bpl-test crossmod_exception
103103
[ bpl-test args ]
104104
[ bpl-test raw_ctor ]
105105
[ bpl-test numpy : printer.py numeric_tests.py numarray_tests.py numpy.py numpy.cpp ]
106-
[ bpl-test enum ]
106+
[ bpl-test enum : test_enum enum_ext.cpp ]
107107
[ bpl-test exception_translator ]
108108
[ bpl-test pearu1 : test_cltree.py cltree.cpp ]
109109
[ bpl-test try : newtest.py m1.cpp m2.cpp ]

test/SConscript

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ for test in ['injected',
4646
'args',
4747
'raw_ctor',
4848
#'numpy',
49-
'enum',
5049
'exception_translator']:
5150
tests+=env.BPLTest(test)
5251

52+
tests+=env.BPLTest('test_enum', ['enum_ext'])
5353
tests+=env.BPLTest('test_cltree', ['cltree'])
5454
tests+=env.BPLTest('newtest', ['m1', 'm2'])
5555
tests+=env.BPLTest('const_argument')

test/andreas_beyer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ def run(args = None):
1717
return doctest.testmod(sys.modules.get(__name__))
1818

1919
if __name__ == '__main__':
20-
print "running..."
20+
print("running...")
2121
import sys
2222
status = run()[0]
23-
if (status == 0): print "Done."
23+
if (status == 0): print("Done.")
2424
sys.exit(status)

test/args.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Copyright David Abrahams 2004. Distributed under the Boost
22
# Software License, Version 1.0. (See accompanying
33
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
4+
from __future__ import print_function
45
"""
56
>>> from args_ext import *
67
@@ -26,7 +27,7 @@
2627
2728
>>> try: f(1, 2, 'hello', bar = 'baz')
2829
... except TypeError: pass
29-
... else: print 'expected an exception: unknown keyword'
30+
... else: print('expected an exception: unknown keyword')
3031
3132
3233
Exercise the functions using default stubs
@@ -72,7 +73,7 @@
7273
7374
>>> try: q.f(1, 2, 'hello', bar = 'baz')
7475
... except TypeError: pass
75-
... else: print 'expected an exception: unknown keyword'
76+
... else: print('expected an exception: unknown keyword')
7677
7778
Exercise member functions using default stubs
7879
@@ -95,10 +96,10 @@
9596
9697
>>> xfuncs = (X.inner0, X.inner1, X.inner2, X.inner3, X.inner4, X.inner5)
9798
>>> for f in xfuncs:
98-
... print f(q,1).value(),
99-
... print f(q, n = 1).value(),
100-
... print f(q, n = 0).value(),
101-
... print f.__doc__.splitlines()[1:5]
99+
... print(f(q,1).value(), end=' ')
100+
... print(f(q, n = 1).value(), end=' ')
101+
... print(f(q, n = 0).value(), end=' ')
102+
... print(f.__doc__.splitlines()[1:5])
102103
1 1 0 ['inner0( (X)self, (bool)n) -> Y :', ' docstring', '', ' C++ signature :']
103104
1 1 0 ['inner1( (X)self, (bool)n) -> Y :', ' docstring', '', ' C++ signature :']
104105
1 1 0 ['inner2( (X)self, (bool)n) -> Y :', ' docstring', '', ' C++ signature :']
@@ -135,10 +136,10 @@ def run(args = None):
135136
return doctest.testmod(sys.modules.get(__name__))
136137

137138
if __name__ == '__main__':
138-
print "running..."
139+
print("running...")
139140
import sys
140141
status = run()[0]
141-
if (status == 0): print "Done."
142+
if (status == 0): print("Done.")
142143
import args_ext
143144
help(args_ext)
144145
sys.exit(status)

test/auto_ptr.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
>>> if not broken_auto_ptr:
2929
... try: x.value()
3030
... except TypeError: pass
31-
... else: print 'expected a TypeError exception'
31+
... else: print('expected a TypeError exception')
3232
3333
>>> x = make()
3434
>>> look(x)
@@ -51,7 +51,7 @@
5151
5252
>>> try: maybe_steal(y, 0)
5353
... except TypeError: pass
54-
... else: print 'expected a TypeError exception'
54+
... else: print('expected a TypeError exception')
5555
5656
>>> y.value()
5757
42
@@ -62,24 +62,24 @@
6262
>>> if not broken_auto_ptr:
6363
... try: y.value()
6464
... except TypeError: pass
65-
... else: print 'expected a TypeError exception'
65+
... else: print('expected a TypeError exception')
6666
67-
>>> print look.__doc__.splitlines()[1]
67+
>>> print(look.__doc__.splitlines()[1])
6868
look( (X)arg1) -> int :
6969
70-
>>> print steal.__doc__.splitlines()[1]
70+
>>> print(steal.__doc__.splitlines()[1])
7171
steal( (X)arg1) -> int :
7272
73-
>>> print maybe_steal.__doc__.splitlines()[1]
73+
>>> print(maybe_steal.__doc__.splitlines()[1])
7474
maybe_steal( (X)arg1, (bool)arg2) -> int :
7575
76-
>>> print make.__doc__.splitlines()[1]
76+
>>> print(make.__doc__.splitlines()[1])
7777
make() -> X :
7878
79-
>>> print callback.__doc__.splitlines()[1]
79+
>>> print(callback.__doc__.splitlines()[1])
8080
callback( (object)arg1) -> X :
8181
82-
>>> print extract.__doc__.splitlines()[1]
82+
>>> print(extract.__doc__.splitlines()[1])
8383
extract( (object)arg1) -> X :
8484
8585
'''
@@ -93,8 +93,8 @@ def run(args = None):
9393
return doctest.testmod(sys.modules.get(__name__))
9494

9595
if __name__ == '__main__':
96-
print "running..."
96+
print("running...")
9797
import sys
9898
status = run()[0]
99-
if (status == 0): print "Done."
99+
if (status == 0): print("Done.")
100100
sys.exit(status)

test/back_reference.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
>>> y_equality(y, y)
1818
1
1919
20-
>>> print y_identity.__doc__.splitlines()[1]
20+
>>> print(y_identity.__doc__.splitlines()[1])
2121
y_identity( (Y)arg1) -> object :
2222
'''
2323

@@ -30,8 +30,8 @@ def run(args = None):
3030
return doctest.testmod(sys.modules.get(__name__))
3131

3232
if __name__ == '__main__':
33-
print "running..."
33+
print("running...")
3434
import sys
3535
status = run()[0]
36-
if (status == 0): print "Done."
36+
if (status == 0): print("Done.")
3737
sys.exit(status)

test/bienstman1.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ def run(args = None):
1616
return doctest.testmod(sys.modules.get(__name__))
1717

1818
if __name__ == '__main__':
19-
print "running..."
19+
print("running...")
2020
import sys
2121
status = run()[0]
22-
if (status == 0): print "Done."
22+
if (status == 0): print("Done.")
2323
sys.exit(status)

test/bienstman2.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ def run(args = None):
1313
return doctest.testmod(sys.modules.get(__name__))
1414

1515
if __name__ == '__main__':
16-
print "running..."
16+
print("running...")
1717
import sys
1818
status = run()[0]
19-
if (status == 0): print "Done."
19+
if (status == 0): print("Done.")
2020
sys.exit(status)

test/bienstman3.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
77
>>> try:
88
... V()
9-
... except RuntimeError, x:
10-
... print x
9+
... except RuntimeError as x:
10+
... print(x)
1111
... else:
12-
... print 'expected an exception'
12+
... print('expected an exception')
1313
...
1414
This class cannot be instantiated from Python
1515
@@ -23,8 +23,8 @@ def run(args = None):
2323
return doctest.testmod(sys.modules.get(__name__))
2424

2525
if __name__ == '__main__':
26-
print "running..."
26+
print("running...")
2727
import sys
2828
status = run()[0]
29-
if (status == 0): print "Done."
29+
if (status == 0): print("Done.")
3030
sys.exit(status)

0 commit comments

Comments
 (0)