How to add my module to travis-ci pythonpath

后端 未结 5 1852
天命终不由人
天命终不由人 2021-01-02 02:08

I\'m setting up Travis-CI for my project, and oddly, I can\'t import my project:

$ python tests/tests.py
Traceback (most recent call last):
  File \"tests/te         


        
5条回答
  •  遥遥无期
    2021-01-02 02:54

    This is certainly not optimal, but it worked. In my .travis.yml file, I added the following line to the install attribute:

     - ln -s `pwd` $(dirname `which python`)/../lib/python2.7/site-packages/my_module
    

    This basically finds the directory where Python is installed and then adds my_module as a symlink in there. Happy to hear a better answer, cause this one feels super fragile.

    Update: See the answer by @Brian Cain for a much better solution.

提交回复
热议问题