【发布时间】:2013-10-31 03:52:10
【问题描述】:
我正在使用 pytest 运行 pep8 检查(下面列出的所有内容都发生在 Windows 机器上):
py.test --pep8 --junitxml=reports\pep8.log
我设置了一个作业来在reports\pep8.log 中查找pep8.log 文件
但是当我运行作业时,我发现违规插件查找报告的路径没有意义:
生成的xml文件: C:\Jenkins\jobs\python-template-2\workspace\reports\pep8.log =============== 89 次失败,33 次跳过,1.48 秒内错误 1 次 =================
C:\Jenkins\jobs\python-template-2\workspace>exit 1 构建步骤 'Выполнить команду Windows' 将构建标记为失败 错误:发布者 hudson.plugins.violations.ViolationsPublisher 由于异常 java.io.FileNotFoundException 而中止: C:\Jenkins\jobs\python-template-2\builds\2013-10-22_13-30-44\violations\file\C:\Jenkins\jobs\python-template-2\工作区\竞赛\迁移\0003_auto__add_votinghistory.py.xml (文件名中的语法错误) 在 java.io.FileOutputStream.open(Native 方法)在 java.io.FileOutputStream.(Unknown Source) at java.io.FileOutputStream.(Unknown Source) at hudson.FilePath.write(FilePath.java:1642) 在 hudson.plugins.violations.generate.ExecuteFilePath.execute(ExecuteFilePath.java:40) 在 hudson.plugins.violations.generate.GenerateXML.execute(GenerateXML.java:47) 在 hudson.plugins.violations.ViolationsCollector.invoke(ViolationsCollector.java:122) 在 hudson.plugins.violations.ViolationsCollector.invoke(ViolationsCollector.java:25) 在 hudson.FilePath.act(FilePath.java:912) 在 hudson.FilePath.act(FilePath.java:885) 在 hudson.plugins.violations.ViolationsPublisher.perform(ViolationsPublisher.java:74) 在 hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:45) 在 hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:781) 在 hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:753) 在 hudson.model.Build$BuildExecution.post2(Build.java:183) 在 hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:706) 在 hudson.model.Run.execute(Run.java:1690) 在 hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46) 在 hudson.model.ResourceController.execute(ResourceController.java:88) 在 hudson.model.Executor.run(Executor.java:230) 完成:失败
另外,我尝试在不使用 pytest 的情况下启动 pep8 检查,而是使用此命令在 windows 上查找并检查所有 .py 文件:
FOR /R %i IN (*.py) DO pep8 %i 1>>reports\pep8.log
在这种情况下,我得到以下信息:
C:\Jenkins\jobs\python-template-2\workspace>exit 1 构建步骤 'Выполнить команду Windows' 将构建标记为失败错误:发布者 hudson.plugins.violations.ViolationsPublisher 由于异常而中止 java.io.FileNotFoundException: C:\Jenkins\jobs\python-template-2\builds\2013-10-15_13-31-37\violations\file\C:\Jenkins\jobs\python-template-2\workspace\notifications\email.py。 xml (文件名中的语法错误) 在 java.io.FileOutputStream.open(Native 方法)在 java.io.FileOutputStream.(Unknown Source) at java.io.FileOutputStream.(Unknown Source) at hudson.FilePath.write(FilePath.java:1666) 在 hudson.plugins.violations.generate.ExecuteFilePath.execute(ExecuteFilePath.java:40) 在 hudson.plugins.violations.generate.GenerateXML.execute(GenerateXML.java:47) 在 hudson.plugins.violations.ViolationsCollector.invoke(ViolationsCollector.java:122) 在 hudson.plugins.violations.ViolationsCollector.invoke(ViolationsCollector.java:25) 在 hudson.FilePath.act(FilePath.java:916) 在 hudson.FilePath.act(FilePath.java:889) 在 hudson.plugins.violations.ViolationsPublisher.perform(ViolationsPublisher.java:74) 在 hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:45) 在 hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:786) 在 hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:758) 在 hudson.model.Build$BuildExecution.post2(Build.java:183) 在 hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:711) 在 hudson.model.Run.execute(Run.java:1690) 在 hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46) 在 hudson.model.ResourceController.execute(ResourceController.java:88) 在 hudson.model.Executor.run(Executor.java:246) 完成:失败
【问题讨论】:
标签: python windows jenkins pytest pep8