Answers: <p>I found a solution to my problem. There is a library <code>diff-cover</code> which does exactly what i need. Here is a link -> <a href="https://diff-cover.readthedocs.io/en/latest/README.html" rel="nofollow noreferrer">https://diff-cover.readthedocs.io/en/latest/README.html</a></p>
  
Answers: CC BY-SA 4.0
Answers: 2020-02-15T16:22:11.437Z
Answers: 2020-02-15T16:22:11.437Z
Answers: Kamil Kapka
Answers: <p>Many Python packages exist for that purpose, one of them is the popular <a href="https://pypi.org/project/coverage/" rel="nofollow noreferrer">coverage</a> package.</p>
  
Answers: CC BY-SA 4.0
Answers: 2020-02-15T07:01:08.030Z
Answers: 2020-02-15T07:01:08.030Z
Answers: michaeldel
Body: <p>I want to force the developers to write unit tests for all new code they wrote. The code is written in python. I want to do it in the Jenkins pipeline. And here is a question. Is there any available Jenkins plugin that can do that? Or python library? I want to avoid sonar qube because I think, it's a little bit complex solution for the problem. I was thinking about a solution, that will detect changed files and check their code coverage percentage in generating a report.</p>
  
Tags: <jenkins><jenkins-pipeline><cicd><python><code-coverage>
Title: How to check minimum code coverage in pull request changes?
UserDisplayName: Kamil Kapka
ThreadText: # How to check minimum code coverage in pull request changes?
  
  (Asked by: username_0 on 2020-02-14)
  
  I want to force the developers to write unit tests for all new code they wrote. The code is written in python. I want to do it in the Jenkins pipeline. And here is a question. Is there any available Jenkins plugin that can do that? Or python library? I want to avoid sonar qube because I think, it's a little bit complex solution for the problem. I was thinking about a solution, that will detect changed files and check their code coverage percentage in generating a report.
  
  **Tags:** jenkins, jenkins-pipeline, cicd, python, code-coverage
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_0 on 2020-02-15. Score: 1 | Accepted answer
  
  I found a solution to my problem. There is a library `diff-cover` which does exactly what i need. Here is a link -> <https://diff-cover.readthedocs.io/en/latest/README.html>
  
  
  ---
  
  ### Answer by username_1 on 2020-02-15. Score: 0
  
  Many Python packages exist for that purpose, one of them is the popular [coverage](https://pypi.org/project/coverage/) package.
  
  
  ---
  
  