Skip to content

Commit be1ef56

Browse files
authored
Merge pull request #34 from nim65s/master
Python 3 tests & CI
2 parents 2478b58 + 2f74114 commit be1ef56

File tree

9 files changed

+246
-145
lines changed

9 files changed

+246
-145
lines changed

.gitlab-ci.yml

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
variables:
2+
GIT_SUBMODULE_STRATEGY: "recursive"
3+
GIT_DEPTH: "3"
4+
CCACHE_BASEDIR: "${CI_PROJECT_DIR}"
5+
CCACHE_DIR: "${CI_PROJECT_DIR}/ccache"
6+
7+
cache:
8+
paths:
9+
- ccache
10+
11+
.robotpkg-py-eigenpy: &robotpkg-py-eigenpy
12+
except:
13+
- gh-pages
14+
script:
15+
- mkdir -p ccache
16+
- cd /root/robotpkg/math/py-eigenpy
17+
- git pull
18+
- make checkout MASTER_REPOSITORY="dir ${CI_PROJECT_DIR}"
19+
- make install
20+
- cd work.$(hostname)/$(make show-var VARNAME=DISTNAME)
21+
- make check
22+
23+
24+
robotpkg-py-eigenpy-dubnium-release:
25+
<<: *robotpkg-py-eigenpy
26+
image: eur0c.laas.fr:5000/stack-of-tasks/eigenpy/py-eigenpy:dubnium
27+
28+
robotpkg-py-eigenpy-16.04-release:
29+
<<: *robotpkg-py-eigenpy
30+
image: eur0c.laas.fr:5000/stack-of-tasks/eigenpy/py-eigenpy:16.04
31+
32+
robotpkg-py-eigenpy-18.04-release:
33+
<<: *robotpkg-py-eigenpy
34+
image: eur0c.laas.fr:5000/stack-of-tasks/eigenpy/py-eigenpy:18.04
35+
36+
robotpkg-py-eigenpy-py3-dubnium-release:
37+
<<: *robotpkg-py-eigenpy
38+
image: eur0c.laas.fr:5000/stack-of-tasks/eigenpy/py-eigenpy-py3:dubnium
39+
allow_failure: true
40+
41+
robotpkg-py-eigenpy-py3-16.04-release:
42+
<<: *robotpkg-py-eigenpy
43+
image: eur0c.laas.fr:5000/stack-of-tasks/eigenpy/py-eigenpy-py3:16.04
44+
allow_failure: true
45+
46+
robotpkg-py-eigenpy-py3-18.04-release:
47+
<<: *robotpkg-py-eigenpy
48+
image: eur0c.laas.fr:5000/stack-of-tasks/eigenpy/py-eigenpy-py3:18.04
49+
50+
robotpkg-py-eigenpy-14.04-release:
51+
<<: *robotpkg-py-eigenpy
52+
image: eur0c.laas.fr:5000/stack-of-tasks/eigenpy/py-eigenpy:14.04
53+
54+
robotpkg-py-eigenpy-14.04-debug:
55+
<<: *robotpkg-py-eigenpy
56+
image: eur0c.laas.fr:5000/stack-of-tasks/eigenpy/py-eigenpy:14.04
57+
before_script:
58+
- echo PKG_OPTIONS.py-eigenpy=debug >> /opt/openrobots/etc/robotpkg.conf
59+
60+
robotpkg-py-eigenpy-py3-14.04-release:
61+
<<: *robotpkg-py-eigenpy
62+
image: eur0c.laas.fr:5000/stack-of-tasks/eigenpy/py-eigenpy-py3:14.04
63+
allow_failure: true
64+
65+
robotpkg-py-eigenpy-py3-14.04-debug:
66+
<<: *robotpkg-py-eigenpy
67+
image: eur0c.laas.fr:5000/stack-of-tasks/eigenpy/py-eigenpy-py3:14.04
68+
before_script:
69+
- echo PKG_OPTIONS.py-eigenpy=debug >> /opt/openrobots/etc/robotpkg.conf
70+
allow_failure: true
71+
72+
robotpkg-py-eigenpy-dubnium-debug:
73+
<<: *robotpkg-py-eigenpy
74+
image: eur0c.laas.fr:5000/stack-of-tasks/eigenpy/py-eigenpy:dubnium
75+
before_script:
76+
- echo PKG_OPTIONS.py-eigenpy=debug >> /opt/openrobots/etc/robotpkg.conf
77+
78+
robotpkg-py-eigenpy-py3-dubnium-debug:
79+
<<: *robotpkg-py-eigenpy
80+
image: eur0c.laas.fr:5000/stack-of-tasks/eigenpy/py-eigenpy-py3:dubnium
81+
before_script:
82+
- echo PKG_OPTIONS.py-eigenpy=debug >> /opt/openrobots/etc/robotpkg.conf
83+
allow_failure: true
84+
85+
robotpkg-py-eigenpy-16.04-debug:
86+
<<: *robotpkg-py-eigenpy
87+
image: eur0c.laas.fr:5000/stack-of-tasks/eigenpy/py-eigenpy:16.04
88+
before_script:
89+
- echo PKG_OPTIONS.py-eigenpy=debug >> /opt/openrobots/etc/robotpkg.conf
90+
91+
robotpkg-py-eigenpy-py3-16.04-debug:
92+
<<: *robotpkg-py-eigenpy
93+
image: eur0c.laas.fr:5000/stack-of-tasks/eigenpy/py-eigenpy-py3:16.04
94+
before_script:
95+
- echo PKG_OPTIONS.py-eigenpy=debug >> /opt/openrobots/etc/robotpkg.conf
96+
allow_failure: true
97+
98+
robotpkg-py-eigenpy-18.04-debug:
99+
<<: *robotpkg-py-eigenpy
100+
image: eur0c.laas.fr:5000/stack-of-tasks/eigenpy/py-eigenpy:18.04
101+
before_script:
102+
- echo PKG_OPTIONS.py-eigenpy=debug >> /opt/openrobots/etc/robotpkg.conf
103+
104+
robotpkg-py-eigenpy-py3-18.04-debug:
105+
<<: *robotpkg-py-eigenpy
106+
image: eur0c.laas.fr:5000/stack-of-tasks/eigenpy/py-eigenpy-py3:18.04
107+
before_script:
108+
- echo PKG_OPTIONS.py-eigenpy=debug >> /opt/openrobots/etc/robotpkg.conf
109+
110+
111+

.travis.yml

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
language: generic
1+
language: python
22
python:
33
- "2.7"
44
sudo: required
@@ -9,7 +9,7 @@ compiler:
99
env:
1010
global:
1111
- secure: "SnIBG/xLIHX3CSvUbqqsX8xTVqIqQ7fFS6HWO6KZQVBsT6yugTwYHbyhNiU531JejYJ/I3ZrDhXfYH3qFZiYxnH1sifvwV+fnTtMXpPN7qPZwIymkjcmm6gJF51e0C7VOfUbvKFv0ngwj+ul21rgZSMuoEvxPK0WxtE3/ZSfn9c="
12-
- APT_DEPENDENCIES="doxygen libeigen3-dev "
12+
- APT_DEPENDENCIES="doxygen libeigen3-dev libboost-test-dev libboost-python-dev libeigen3-dev"
1313
- DEBSIGN_KEYID=5AE5CD75
1414
- CC=gcc
1515
- DO_COVERAGE_ON_BRANCH="master;release"
@@ -19,24 +19,18 @@ env:
1919
- BUILDTYPE=Release
2020
- BUILDTYPE=Debug
2121
notifications:
22-
email:
23-
22+
email:
23+
- pinocchio-build@laas.fr
2424
branches:
25-
only:
26-
- master
27-
- debian
28-
- devel
29-
matrix:
30-
allow_failures:
31-
- compiler:
32-
before_install: ./travis_custom/custom_before_install
33-
install:
34-
- pip install --user coveralls
35-
- pip install --user numpy
25+
only:
26+
- master
27+
- debian
28+
- devel
29+
before_install: ./.travis/run before_install
30+
install: pip install coveralls numpy
3631
script:
3732
- export CMAKE_ADDITIONAL_OPTIONS="-DCMAKE_BUILD_TYPE=${BUILDTYPE}"
3833
- sudo free -m -t
3934
- ./.travis/run ../travis_custom/custom_build
4035
after_failure: ./.travis/run after_failure
41-
after_success:
42-
- ./.travis/run after_success
36+
after_success: ./.travis/run after_success

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ INCLUDE(cmake/base.cmake)
2020
INCLUDE(cmake/boost.cmake)
2121
INCLUDE(cmake/python.cmake)
2222
INCLUDE(cmake/ide.cmake)
23+
INCLUDE(cmake/test.cmake)
2324

2425
SET(PROJECT_NAME eigenpy)
2526
SET(PROJECT_DESCRIPTION "Wrapping Eigen3 -- numpy")

cmake

Submodule cmake updated 1 file

travis_custom/custom_before_install

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

unittest/CMakeLists.txt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#
1+
#
22
# Copyright (c) 2016-2018 CNRS
3-
#
3+
#
44
# This file is part of eigenpy
55
# eigenpy is free software: you can redistribute it
66
# and/or modify it under the terms of the GNU Lesser General Public
@@ -31,7 +31,7 @@ MACRO(ADD_LIB_UNIT_TEST test PKGS)
3131
# We need to change the extension for python bindings
3232
SET_TARGET_PROPERTIES(${test} PROPERTIES SUFFIX ".so")
3333
ENDIF(APPLE)
34-
34+
3535
ADD_TEST(NAME ${test} COMMAND ${PYTHON_EXECUTABLE} -c "import ${test}")
3636
ADD_DEPENDENCIES(check ${test})
3737
ENDMACRO(ADD_LIB_UNIT_TEST)
@@ -44,3 +44,5 @@ IF(NOT ${EIGEN3_VERSION} VERSION_LESS "3.2.0")
4444
ADD_LIB_UNIT_TEST(ref "eigen3")
4545
ENDIF()
4646

47+
ADD_PYTHON_UNIT_TEST("py-matrix" "unittest/python/test_matrix.py" "unittest")
48+
ADD_PYTHON_UNIT_TEST("py-geometry" "unittest/python/test_geometry.py" "unittest")

unittest/python/test_eigenpy.py

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

unittest/python/test_geometry.py

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
from __future__ import print_function
2+
13
from geometry import *
24
import numpy as np
35
from numpy import cos,sin
46

5-
verbose = False
7+
verbose = True
68

79
def isapprox(a,b,epsilon=1e-6):
810
if issubclass(a.__class__,np.ndarray) and issubclass(b.__class__,np.ndarray):
@@ -33,18 +35,18 @@ def isapprox(a,b,epsilon=1e-6):
3335
assert(isapprox(qR[3],1./np.sqrt(30)))
3436
try:
3537
qR[5]
36-
print "Error, this message should not appear."
37-
except Exception,e:
38-
if verbose: print "As expected, catched exception: ",e.message
38+
print("Error, this message should not appear.")
39+
except RuntimeError as e:
40+
if verbose: print("As expected, catched exception: ",e)
3941

4042
# --- Angle Vector ------------------------------------------------
41-
r = AngleAxis(.1,np.array([1,0,0],np.double))
42-
if verbose: print "Rx(.1) = \n\n",r.matrix(),"\n"
43+
r = AngleAxis(.1,np.matrix([1,0,0],np.double).T)
44+
if verbose: print("Rx(.1) = \n\n",r.matrix(),"\n")
4345
assert( isapprox(r.matrix()[2,2],cos(r.angle)))
4446
assert( isapprox(r.axis,np.matrix("1;0;0")) )
4547
assert( isapprox(r.angle,0.1) )
4648

47-
r.axis = np.array([0,1,0],np.double)
49+
r.axis = np.matrix([0,1,0],np.double).T
4850
assert( isapprox(r.matrix()[0,0],cos(r.angle)))
4951

5052
ri = r.inverse()
@@ -62,10 +64,5 @@ def isapprox(a,b,epsilon=1e-6):
6264

6365
qo = testOutQuaternion()
6466
assert(qo.__class__ == Quaternion)
65-
res = testInQuaternion_fx(q)
67+
res = testInQuaternion(q)
6668
assert(q.norm() == res)
67-
try:
68-
testInQuaternion(q)
69-
print "Error, this message should not appear."
70-
except:
71-
if verbose: print "As expected, catch a Boost::python::ArgError exception."

0 commit comments

Comments
 (0)