How to add my module to travis-ci pythonpath

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

    What's the best way to make this work, so my code is added as an importable module?

    The answer is unequivocally to use distutils (and definitely not ln).

    In production, I just create a symlink ...

    B-b-but why? The complexity to do it the Right Way™ is so low! It even fits in a few lines:

    From The Fine Manual -- just create a setup.py like this:

    from distutils.core import setup
    
    setup(name='Distutils',
          version='1.0',
          description='Python Distribution Utilities',
          author='Greg Ward',
          author_email='gward@python.net',
          url='https://www.python.org/sigs/distutils-sig/',
          packages=['distutils', 'distutils.command'],
         )
    

    Now you can do fantastic things like python setup.py install, python setup.py bdist_rpm or pip install . -- and not just in the Travis environment but for your project in general.

提交回复
热议问题