How to add my module to travis-ci pythonpath

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

    In complement of @Brian-Cain answer, you can also use setuptools instead of distutils. As of writing, distutils is being phased out, and setuptools is being used as a replacement, even though setuptools is not yet in standard library.

    from setuptools import setup, find_packages
    
    setup(name='Foo',
          version='0.0.1',
          description='Python Distribution Utilities',
          author='',
          author_email='',
          url='',
          packages=find_packages(exclude=['contrib', 'docs', 'tests*']),
         )
    

    For a quick tutorial on making a setup.py with setuptools: https://packaging.python.org/tutorials/distributing-packages/

    For a quick real example: https://github.com/pypa/sampleproject/blob/master/setup.py

提交回复
热议问题