> 技术文档 > Jenkins中出现pytest: error: unrecognized arguments: --alluredir=report错误解决办法

Jenkins中出现pytest: error: unrecognized arguments: --alluredir=report错误解决办法


错误收集

Started by user 偷走晚霞的人 Running as SYSTEM Building in workspace C:\\Users\\Administrator\\.jenkins\\workspace\\TestAAA [TestAAA] $ cmd /c call C:\\Users\\Administrator\\AppData\\Local\\Temp\\jenkins17106704475145676313.bat C:\\Users\\Administrator\\.jenkins\\workspace\\TestAAA>cd C:\\Users\\Administrator\\PycharmProjects\\PyTest C:\\Users\\Administrator\\PycharmProjects\\PyTest>pytest --alluredir=report test_skip.py ERROR: usage: pytest [options] [file_or_dir] [file_or_dir] [...] pytest: error: unrecognized arguments: --alluredir=report inifile: None rootdir: C:\\Users\\Administrator\\PycharmProjects\\PyTest C:\\Users\\Administrator\\PycharmProjects\\PyTest>exit 4 Build step \'Execute Windows batch command\' marked build as failure Unpacking https://repo1.maven.org/maven2/io/qameta/allure/allure-commandline/2.34.1/allure-commandline-2.34.1.zip to C:\\Users\\Administrator\\.jenkins\\tools\\ru.yandex.qatools.allure.jenkins.tools.AllureCommandlineInstallation\\Allure_Commandline on Jenkins

错误分析

查看有没有python 有没有安装 allure包

pip list 

可以发现,并没有安装对应的包

pip install allure-pytest

安装信息

C:\\Users\\Administrator>pip install allure-pytest
Collecting allure-pytest
  Downloading allure_pytest-2.15.0-py3-none-any.whl.metadata (3.0 kB)
Requirement already satisfied: pytest>=4.5.0 in d:\\program\\util\\lib\\site-packages (from allure-pytest) (8.4.1)
Collecting allure-python-commons==2.15.0 (from allure-pytest)
  Downloading allure_python_commons-2.15.0-py3-none-any.whl.metadata (5.7 kB)
Collecting attrs>=16.0.0 (from allure-python-commons==2.15.0->allure-pytest)
  Downloading attrs-25.3.0-py3-none-any.whl.metadata (10 kB)
Requirement already satisfied: pluggy>=0.4.0 in d:\\program\\util\\lib\\site-packages (from allure-python-commons==2.15.0->allure-pytest) (1.6.0)
Requirement already satisfied: colorama>=0.4 in d:\\program\\util\\lib\\site-packages (from pytest>=4.5.0->allure-pytest) (0.4.6)
Requirement already satisfied: iniconfig>=1 in d:\\program\\util\\lib\\site-packages (from pytest>=4.5.0->allure-pytest) (2.1.0)
Requirement already satisfied: packaging>=20 in d:\\program\\util\\lib\\site-packages (from pytest>=4.5.0->allure-pytest) (25.0)
Requirement already satisfied: pygments>=2.7.2 in d:\\program\\util\\lib\\site-packages (from pytest>=4.5.0->allure-pytest) (2.19.2)
Downloading allure_pytest-2.15.0-py3-none-any.whl (12 kB)
Downloading allure_python_commons-2.15.0-py3-none-any.whl (16 kB)
Downloading attrs-25.3.0-py3-none-any.whl (63 kB)
Installing collected packages: attrs, allure-python-commons, allure-pytest
Successfully installed allure-pytest-2.15.0 allure-python-commons-2.15.0 attrs-25.3.0

解决办法

使用 pip install allure-pytest 安装

运行结果