lcm-proj / lcm

Lightweight Communications and Marshalling
GNU Lesser General Public License v2.1
980 stars 388 forks source link

python: Unittests fail for Python 3? #347

Closed EricCousineau-TRI closed 2 years ago

EricCousineau-TRI commented 3 years ago

Ran across this while writing #346. FWIW Python 2's EOL passed, and I think the ecosystem surround it will prolly start crumbling slowly? https://www.python.org/doc/sunset-python-2/ https://pythonclock.org/

On master @ 501bb44, Ubuntu 18.04, CPython 3.6.9, I get the following unittest failures:

cd lcm
mkdir build && cd build
cmake .. -DPYTHON_EXECUTABLE=$(which python3) -DLCM_ENABLE_PYTHON=ON -DLCM_ENABLE_JAVA=OFF -DLCM_ENABLE_LUA=OFF -DLCM_ENABLE_GO=OFF
make
ctest -V -R Python

Failures:

6: Traceback (most recent call last):                                                                                                       
6:   File "/home/eacousineau/devel/lcm/test/python/bool_test.py", line 17, in test_bool                                                     
6:     for a_index in xrange(msg.num_a):                                                                                                    
6: NameError: name 'xrange' is not defined  
...
7: Traceback (most recent call last):                                                                                                       
7:   File "/home/eacousineau/devel/lcm/test/python/byte_array_test.py", line 13, in test_construct                                          
7:     msg.encode()                                                                                                                         
7:   File "/home/eacousineau/devel/lcm/build/test/types/lcmtest/byte_array_t.py", line 26, in encode                                        
7:     self._encode_one(buf)                                                                                                                
7:   File "/home/eacousineau/devel/lcm/build/test/types/lcmtest/byte_array_t.py", line 31, in _encode_one                                   
7:     buf.write(bytearray(self.data[:self.num_bytes]))                                                                                     
7: TypeError: string argument without an encoding