BewareMyPower commented on pull request #9684:
URL: https://github.com/apache/pulsar/pull/9684#issuecomment-784250308


   After the latest commit, the python client tests (`pulsar_test.py`) could 
pass in my docker image. However, there're still a lot to do with python 
functions.
   
   For example:
   
   ```
   ======================================================================
   ERROR: test_python_instance (unittest.loader._FailedTest)
   ----------------------------------------------------------------------
   ImportError: Failed to import test module: test_python_instance
   Traceback (most recent call last):
     File "/usr/lib/python3.5/unittest/loader.py", line 428, in _find_test_path
       module = self._get_module_from_name(name)
     File "/usr/lib/python3.5/unittest/loader.py", line 369, in 
_get_module_from_name
       __import__(name)
     File 
"/pulsar/pulsar-functions/instance/target/python-instance/tests/test_python_instance.py",
 line 23, in <module>
       from mock import Mock
     File "/root/.local/lib/python3.5/site-packages/mock/__init__.py", line 7, 
in <module>
       import mock.mock as _mock
     File "/root/.local/lib/python3.5/site-packages/mock/mock.py", line 765
       mock_name = f'{self._extract_mock_name()}.{name}'
                                                       ^
   SyntaxError: invalid syntax
   ```
   
   It looks like the [`mock` module](https://pypi.org/project/mock/) uses the 
[f-strings](https://realpython.com/python-f-strings/), which was introduced 
from Python 3.6. Therefore it requires Python >= 3.6. However the Ubuntu 
16.04's python3 version is 3.5. So we need to find an alternative module.
   
   On the other hand, I found [python functions 
code](https://github.com/apache/pulsar/tree/master/pulsar-functions/instance/src/main/python)
 still use some python2 legacy code.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to