How to add my module to travis-ci pythonpath

后端 未结 5 1844
天命终不由人
天命终不由人 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:55

    To be quick, you can fix the problem more elegantly by adding the following to the before_script stage:

    export PYTHONPATH=$PYTHONPATH:$(pwd)
    

    The better way(but with a little more effort) is what Brian Cain has suggested, namely, write a setup.py file and add pip install . to the install stage.

    Or if you're using a makefile you can have command that does it as the following one.

    test:
        $(shell export PYTHONPATH=$PYTHONPATH:$(pwd))
        python setup.py test
    

提交回复
热议问题