Cython & Python Project Test Driven Development an

2019-04-26 19:08发布

What is the best way to structure a python/cython project such that I can unit test code that resides in .pyx files? Is it possible to unit test this code in place or will refactoring allow me to achieve this in another way?

I am new to cython but have experience with Python TDD, mocking etc. I am also aware that the decision to cythonise some of the python code base could have been a premature optimisation decision. I have just joined a new team and therefore I am working on an existing code base. I am trying to get a feel for best practices.

Also in PyCharm, modules written in .pyx files are show as unresolved references in the editor - I have just read about pyximport but I am not sure if PyCharm is set up correctly for cython (I have the latest professional edition).

I am aware of the cython user guide but I cannot find advice on testing. I am also aware of pycharm's setup guide but this suggests that cython support is out of the box, which seems to contradict what I experience.

0条回答
登录 后发表回答