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?
You're now ready to create your Pipeline that will automate building your Python application with PyInstaller in Jenkins. Your Pipeline will be created as a Jenkinsfile , which will be committed to your locally cloned Git repository ( simple-python-pyinstaller-app ).
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'
}
}
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"
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With