Cython & Python Project Test Driven Development and .pyx file structure advice

我的梦境 提交于 2019-12-10 02:57:55

问题


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.

来源:https://stackoverflow.com/questions/32520976/cython-python-project-test-driven-development-and-pyx-file-structure-advice

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!