{"id":203,"date":"2020-01-29T13:36:30","date_gmt":"2020-01-29T08:06:30","guid":{"rendered":"http:\/\/blogs.shydrate.com\/?p=203"},"modified":"2020-01-29T13:36:33","modified_gmt":"2020-01-29T08:06:33","slug":"running-pytest-in-jenkins","status":"publish","type":"post","link":"https:\/\/blogs.shydrate.com\/index.php\/2020\/01\/29\/running-pytest-in-jenkins\/","title":{"rendered":"Running pytest in Jenkins"},"content":{"rendered":"\n<p>In this blog, I will show how to run pytest in Jenkins. To run Python scripts in Jenkins, you can refer my previous <a href=\"http:\/\/blogs.shydrate.com\/index.php\/2020\/01\/29\/running-python-scripts-in-jenkins\/\">blog<\/a>. In order to run the pytest in the cloud, install pytest library. I have added requirements file. Run it by the command &#8220;pip3 install -r requirements.txt&#8221;.<\/p>\n\n\n\n<p>I have created a freestyle project, Which pulls source code from git and runs the script. My <a href=\"https:\/\/github.com\/shydrate\/pytest_python\">git repo<\/a>.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"455\" src=\"http:\/\/blogs.shydrate.com\/wp-content\/uploads\/2020\/01\/image-1024x455.png\" alt=\"\" class=\"wp-image-204\" srcset=\"https:\/\/blogs.shydrate.com\/wp-content\/uploads\/2020\/01\/image-1024x455.png 1024w, https:\/\/blogs.shydrate.com\/wp-content\/uploads\/2020\/01\/image-300x133.png 300w, https:\/\/blogs.shydrate.com\/wp-content\/uploads\/2020\/01\/image-768x341.png 768w, https:\/\/blogs.shydrate.com\/wp-content\/uploads\/2020\/01\/image.png 1226w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Underbuild section, select Execute Windows batch command. For the first build add &#8220;pip3 install -r requirements.txt&#8221;, so that it will install libraries. After a successful run,  And add these command  \u201cSET PATH=%PATH%;%Python_path% dir pytest -v -s\u201d and remove previous command.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"335\" src=\"http:\/\/blogs.shydrate.com\/wp-content\/uploads\/2020\/01\/image-1-1024x335.png\" alt=\"\" class=\"wp-image-205\" srcset=\"https:\/\/blogs.shydrate.com\/wp-content\/uploads\/2020\/01\/image-1-1024x335.png 1024w, https:\/\/blogs.shydrate.com\/wp-content\/uploads\/2020\/01\/image-1-300x98.png 300w, https:\/\/blogs.shydrate.com\/wp-content\/uploads\/2020\/01\/image-1-768x251.png 768w, https:\/\/blogs.shydrate.com\/wp-content\/uploads\/2020\/01\/image-1.png 1131w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Save the project and click on the build project.<\/p>\n<!-- AddThis Advanced Settings generic via filter on the_content --><!-- AddThis Share Buttons generic via filter on the_content -->","protected":false},"excerpt":{"rendered":"<p>In this blog, I will show how to run pytest in Jenkins. To run Python scripts in Jenkins, you can refer my previous blog. In order to run the pytest in the cloud, install pytest library. I have added requirements<!-- AddThis Advanced Settings generic via filter on get_the_excerpt --><!-- AddThis Share Buttons generic via filter on get_the_excerpt --><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[44,42,43,40,41],"class_list":["post-203","post","type-post","status-publish","format-standard","hentry","category-my-articles","tag-devops","tag-jenkiins","tag-pip","tag-pytest","tag-python"],"_links":{"self":[{"href":"https:\/\/blogs.shydrate.com\/index.php\/wp-json\/wp\/v2\/posts\/203","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.shydrate.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.shydrate.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.shydrate.com\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.shydrate.com\/index.php\/wp-json\/wp\/v2\/comments?post=203"}],"version-history":[{"count":1,"href":"https:\/\/blogs.shydrate.com\/index.php\/wp-json\/wp\/v2\/posts\/203\/revisions"}],"predecessor-version":[{"id":206,"href":"https:\/\/blogs.shydrate.com\/index.php\/wp-json\/wp\/v2\/posts\/203\/revisions\/206"}],"wp:attachment":[{"href":"https:\/\/blogs.shydrate.com\/index.php\/wp-json\/wp\/v2\/media?parent=203"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.shydrate.com\/index.php\/wp-json\/wp\/v2\/categories?post=203"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.shydrate.com\/index.php\/wp-json\/wp\/v2\/tags?post=203"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}