Started template |
||
---|---|---|
.github | ||
bench | ||
changelog | ||
doc/en | ||
extra | ||
scripts | ||
src | ||
testing | ||
.coveragerc | ||
.git-blame-ignore-revs | ||
.gitattributes | ||
.gitignore | ||
.pre-commit-config.yaml | ||
.readthedocs.yml | ||
AUTHORS | ||
CHANGELOG.rst | ||
CITATION | ||
CODE_OF_CONDUCT.md | ||
CONTRIBUTING.rst | ||
LICENSE | ||
OPENCOLLECTIVE.rst | ||
README.md | ||
README.rst | ||
RELEASING.rst | ||
TIDELIFT.rst | ||
codecov.yml | ||
pyproject.toml | ||
testing.txt | ||
tox.ini |
README.md
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
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.
Your own coverage tool
Anastasia create_terminal_writer()  New branch coverage: 100% <Function 2 name> def _strtobool()
<Show a patch (diff) or a link to a commit made in your forked repository that shows the instrumented code to gather coverage measurements>
New branch coverage: 100%
Coverage improvement
Individual tests
Anastasia
<Test 1>
<Show a patch (diff) or a link to a commit made in your forked repository that shows the new/enhanced test>
<Provide a screenshot of the old coverage results (the same as you already showed above)>
Previous branch coverage: 50%
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.
<Test 2>
<Show a patch (diff) or a link to a commit made in your forked repository that shows the new/enhanced test>
<Provide a screenshot of the old coverage results (the same as you already showed above)> 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
<Function 1 name> fullwidth()
<Show a patch (diff) or a link to a commit made in your forked repository that shows the instrumented code to gather coverage measurements>
<Function 2 name>
<Provide the same kind of information provided for Function 1>
Coverage improvement
Individual tests
Ana Alexandra Cornea
<Test 1>
<Provide a screenshot of the old coverage results (the same as you already showed above)>
<Test 2>
<Provide the same kind of information provided for Test 1>
<Show a patch (diff) or a link to a commit made in your forked repository that shows the instrumented code to gather coverage measurements>
Liang Laura Moragues Hincapie
<Function 1 name> get_terminal_width()
<Show a patch (diff) or a link to a commit made in your forked repository that shows the instrumented code to gather coverage measurements>
<Function 2 name> _highlight
<Provide the same kind of information provided for Function 1>
Coverage improvement
Individual tests
Liang Laura Moragues Hincapie
<Test 1>
<Show a patch (diff) or a link to a commit made in your forked repository that shows the new/enhanced test>
<Provide a screenshot of the old coverage results (the same as you already showed above)>
New branch coverage is 100%
<Test 2>
<Show a patch (diff) or a link to a commit made in your forked repository that shows the new/enhanced test>
<Provide a screenshot of the old coverage results (the same as you already showed above)>
Anda Gabriela Barbu
<Function 1 name> should_do_markup()
<Show a patch (diff) or a link to a commit made in your forked repository that shows the instrumented code to gather coverage measurements> 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()
<Function 2 name>
<Provide the same kind of information provided for Function 1>
Coverage improvement
Individual tests
<Test 1>
<Show a patch (diff) or a link to a commit made in your forked repository that shows the new/enhanced test>
<Provide a screenshot of the old coverage results (the same as you already showed above)>
<Test 2>
<Show a patch (diff) or a link to a commit made in your forked repository that shows the new/enhanced test>
<Provide a screenshot of the old coverage results (the same as you already showed above)>
Overall
<Provide a screenshot of the old coverage results by running an existing tool (the same as you already showed above)>