简体   繁体   English

执行`setup.py test`时不要安装依赖项

[英]Don't install dependencies when performing `setup.py test`

I want to do an offline installation of a python package. 我想做一个python包的离线安装。 As part of the installation, I run the package's tests with python3 setup.py test . 作为安装的一部分,我使用python3 setup.py test运行包的python3 setup.py test When I run the test command, setuptools fetches all of the unsatisfied dependencies from pypi.python.org . 当我运行test命令时,setuptools从pypi.python.org获取所有不满意的依赖项。 However I'm providing all of the package's dependencies and if a dependency isn't satisfied, I want that to be an error -- I don't want setuptools to download dependencies for me. 但是我提供了所有软件包的依赖项,如果不满足依赖项,我希望这是一个错误 - 我不希望setuptools为我下载依赖项。 I'm not sure how to disable this behavior, or even how to tell it to use a different server. 我不知道如何禁用此行为,甚至不知道如何告诉它使用不同的服务器。 How can I stop this? 我怎么能阻止这个?

OK, so here's one way to do it. 好的,所以这是一种方法。 It's possibly not the most elegant and it has some downsides, but it seems to work. 它可能不是最优雅的,它有一些缺点,但似乎有效。

Create (or modify an existing) setup.cfg file with the following lines: 使用以下行创建(或修改现有的) setup.cfg文件:

[easy_install]
find_links = file:///dev/null
index_url = file:///dev/null

This will inform easy_install (which is what is operating under the hood) to not use any external pypi server. 这将告知easy_install (这是在引擎盖下操作)不使用任何外部pypi服务器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM