From eb1fb0ef0de0ef64de134489dcff0ab3de27437b Mon Sep 17 00:00:00 2001 From: Liang Laura Moragues Hincapie <122705116+llmh3624@users.noreply.github.com> Date: Thu, 27 Jun 2024 22:23:59 +0200 Subject: [PATCH] Create README.md Started template --- README.md | 373 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 373 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 000000000..f0908da0b --- /dev/null +++ b/README.md @@ -0,0 +1,373 @@ +# Report for Assignment 1 + +## Project chosen + +Name: Pytest + +URL: https://github.com/pytest-dev/pytest/tree/main + +Number of lines of code and the tool used to count it: 77.686 - lizard +![Screenshot 2024-06-27 at 22 16 31](https://github.com/apanayotova03/pytest/assets/122705116/d227c09a-97b9-4d79-a9f8-93f7f5c58616) + +Programming language: Python + +## Coverage measurement + +### Existing tool + + + +We used tox to run the tests and measured their coverage using coverage.py. The specific commands that were used are: + +$ tox +$ coverage html + +This allowed us to run all tests in the repository and summarised the coverage of each test in an html file. Here is a screenshot of the results: + + +The results indicate that the tests have a branch coverage of 38% on the program. + + +![Screenshot 2024-06-27 at 22 18 22](https://github.com/apanayotova03/pytest/assets/122705116/74aedda1-54a4-4a50-bd9b-8af833493ef8) + +### Your own coverage tool + + + Anastasia + create_terminal_writer() + +![Screenshot 2024-06-27 at 22 19 26](https://github.com/apanayotova03/pytest/assets/122705116/b4933dba-97e4-4337-acc1-1d77c9afb250) + + +New branch coverage: 100% +![Screenshot 2024-06-27 at 22 20 47](https://github.com/apanayotova03/pytest/assets/122705116/e2c5a548-2373-4c05-9710-31666b811296) + + + def _strtobool() + + + + + +New branch coverage: 100% + + +## Coverage improvement + +### Individual tests + + + + Anastasia + + + + +![Screenshot 2024-06-27 at 22 21 40](https://github.com/apanayotova03/pytest/assets/122705116/9ef88a09-957d-4a18-90cc-b7ae1c855155) + + + + +Previous branch coverage: 50% + +![Screenshot 2024-06-27 at 22 22 09](https://github.com/apanayotova03/pytest/assets/122705116/372df057-4d83-4435-abdd-2a5669de463a) + + + + +New branch coverage: 100% + + + + +The branch coverage has doubled from 50% to 100%. The reason is because the previous tests did not check every case, for example the case when the colour option was either set to “yes” or “no”. However, the new test checks for all four different cases. + + + + + + + + + + +Previous branch coverage: 0% + + + + + + + +The branch coverage has improved from 0% to 100%. In the original test, neither of the branches were covered, possibly due to the fact that the function was not called. However, the new test checks all 3 different branches, creating a branch coverage of 100%. + + + + + + + + + + + + + + + + + + + + + + + + + + Ana Alexandra Cornea + + fullwidth() + + + + + + + + + + + + +## Coverage improvement + +### Individual tests + + + + Ana Alexandra Cornea + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Liang Laura Moragues Hincapie + + get_terminal_width() + + + + + + + + _highlight + + + +## Coverage improvement + +### Individual tests + + + + Liang Laura Moragues Hincapie + + + + + + + + + + + + + +New branch coverage is 100% + + + + + + + + + + + + + + + + + Anda Gabriela Barbu + + should_do_markup() + + +The code of the new test after creating a branch array + + +def test(): + # Branch Id 1 + os.environ["PY_COLORS"] = "1" + test = should_do_markup(None) + del os.environ["PY_COLORS"] + assert test == True + + + os.environ["PY_COLORS"] = "0" + test = should_do_markup(None) + del os.environ["PY_COLORS"] + assert test == False + + + # Branch Id 3 + os.environ["NO_COLOR"] = "1" + test = should_do_markup(None) + del os.environ["NO_COLOR"] + assert test == False + + + # Branch Id 4 + os.environ["FORCE_COLOR"] = "1" + test = should_do_markup(None) + del os.environ["FORCE_COLOR"] + assert test == True + + + # Branch Id 5 + test = should_do_markup(None) + assert test == False + + + os.environ["PY_COLORS"] = "1" +if __name__ == "__main__": + test() + + + + + + + + + + + + + + + + + + + + + + +## Coverage improvement + +### Individual tests + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +### Overall + + + + + +## Statement of individual contributions + +