6

currently i execute my tests in pytest by command like "pytest mytest.py" copied to inside form field "Execute Windows batch command" in the job Jenkins. I want to change my job to execute it by pipeline. I try a lot of code from Stackoverflow but any one of them doesn't work. Do you have a simple code to run regresion tests with pytest connection to Git?

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
pyMike
  • 61
  • 1
  • 1
  • 4

2 Answers2

2

I'll suggest you to use : 'Pyenv Pipeline' plugin (https://plugins.jenkins.io/pyenv-pipeline)

stage("test PythonEnv") {

    withPythonEnv('python3') {
        sh 'pip install pytest'
        sh 'pytest mytest.py'
    }
}
EricD
  • 306
  • 1
  • 4
1

If you are just after running it as simple Jenkins pipeline (say scripted for now), you can run something like below?

node
{
   stage('Run pytest') 
   {
       bat "pytest mytest.py"
   }    
}
vinWin
  • 509
  • 1
  • 5
  • 18