我在 shell 脚本中有以下函数:
test_handler(){
FOLDER_NAME=$1
echo "running tests in: ${FOLDER_NAME} package"
cd ${SOURCE_CODE_FOLDER}/${FOLDER_NAME}
pipenv install --dev
#need to run this with pipenv run to get the install dependencies.
pipenv run run-tests
EXIT_CODE=$?
if [ ${EXIT_CODE} != 0 ];then
echo "error, Exit code=${EXIT_CODE} in ${FOLDER_NAME}'s tests." >> /home/logs.txt;
exit 1;
fi;
echo "${FOLDER_NAME}'s tests succeeded." >> /home/logs.txt;
}
Run Code Online (Sandbox Code Playgroud)
该函数工作正常,在脚本中被调用两次,使用两个不同的文件夹名称,每个文件夹名称都有一个“测试”包,里面有 pytests。
该行pipenv run run-tests正在运行以下脚本:
#!/bin/bash
python3.7 -m pytest -s --cov-append --junitxml=/home/algobot-packer/tests.xml $PWD/tests/
EXIT_CODE=$?
exit ${EXIT_CODE}
Run Code Online (Sandbox Code Playgroud)
最终它生成一个tests.xml 文件。唯一的问题是第二个函数调用覆盖了第一个函数调用。
有没有办法生成一个 xml 文件来保存两次运行测试脚本的结果?(附加结果而不是重写文件)我试过查看文档和 …
编辑
我正在尝试导入包algosec.models内的文件algobot。
我试过添加--hidden-import algosec,我也试过在导入之前添加路径,使用sys.path.append(./../algosec)
这是我尝试运行程序时收到的错误消息:
Traceback (most recent call last):
File "algobot_packer/algobot.py", line 2, in <module>
File "PyInstaller/loader/pyimod03_importers.py", line 546, in exec_module
File "algobot/cli/cli.py", line 3, in <module>
File "PyInstaller/loader/pyimod03_importers.py", line 546, in exec_module
File "algobot/microsoft_teams/mainloop.py", line 9, in <module>
File "PyInstaller/loader/pyimod03_importers.py", line 546, in exec_module
File "algobot/framework/configuration.py", line 34, in <module>
File "PyInstaller/loader/pyimod03_importers.py", line 546, in exec_module
File "algobot/framework/commands.py", line 22, in <module>
File "PyInstaller/loader/pyimod03_importers.py", line 546, in exec_module
File "algobot/framework/bot.py", line …Run Code Online (Sandbox Code Playgroud) 从一些网上阅读来看,sed的flag用法似乎-e是注释一个sed脚本
例如:
sed -i -e 's/default_language/language/g' "$CONF_FILE"
但从自我测试和一些在线搜索来看,这条线似乎也应该有效:
sed -i 's/default_language/language/g' "$CONF_FILE"
那么我需要什么呢-e?它只适用于我想连续编写多个脚本的情况吗?这也可以通过 进行管理;。
python ×2
bash ×1
flags ×1
junit ×1
pipenv ×1
pipfile ×1
pyinstaller ×1
pytest ×1
python-3.x ×1
sed ×1