在使用 pytest 开始测试之前,我需要安装一个 python 插件,它是一个简单的 python 文件。我在 setup.py 中使用了 entry_points。我的问题有点复杂,让我们通过一个例子来解决这个问题,我们稍后再回到这个问题。
有两个包 - 一个是core,另一个是mypackage。
核心提供了添加名为“ my.plugin ”的插件的功能。
from importlib_metadata import entry_points
def plugin_method(some_data):
plugins = entry_points()['my.plugin']
loaded_plugins = []
for p in plugins:
loaded_plugins.apend(p.load())
#Does some processing on the data and decides which method to call from plugin
#call plugin method
return result
Run Code Online (Sandbox Code Playgroud)
设置文件
setup(
...
entry_points={'my.plugin': 'plugin1= plugin1.logic'}
...
)
Run Code Online (Sandbox Code Playgroud)
逻辑文件
def method1(method_data):
print('method1 called')
return 1
def method2(method_data):
print('method1 called')
return 2
Run Code Online (Sandbox Code Playgroud)
主文件 …
无法安装 JSHint。谁能建议我我做错了什么?
我正在使用下面的命令。
npm install --save-dev gulp-jshint gulp-jscs jshint-stylish
它显示以下“gulp-jshint@2.0.4 需要 jshint@2.x 的对等点,但没有安装 - UNMET 对等依赖项”
gulp ×1
javascript ×1
jenkins ×1
jshint ×1
node.js ×1
npm ×1
pytest ×1
python-3.x ×1
setuptools ×1