是否可以/是否可以通过pytest动态创建jenkins管道阶段的插件? (在管道中运行pytest,然后pytest运行的每个测试都会在管道中创建一个新阶段,因此詹金斯工作的蔚蓝海景将为所有测试创建阶段)。
我可能会列出将要运行的所有测试,然后手动并行运行它们,如下所示:
stage("Run Tests"){
steps {
script {
def tests = sh(script: "pytest tests/ --collect-only", returnStdout: true).trim().split().toList()
// manipulate tests so that I have a dictionary of filename - test name
run_tests = [:]
tests.each { test -> //test[0] is file name and test[1] is test name
run_tests[test[1]] = {
stage(test[1]) {
sh "pytest ${test[0]} -k ${test[1]}"
}
}
}
parallel run_tests
}
}
}
但是,如果在pytest或Jenkins中有本机的方式可以做到这一点
谢谢!