Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Low code coverage with Codecov.io - tests needed #137

Closed
ilikerustoo opened this issue Feb 14, 2019 · 16 comments · Fixed by #185
Closed

Low code coverage with Codecov.io - tests needed #137

ilikerustoo opened this issue Feb 14, 2019 · 16 comments · Fixed by #185

Comments

@ilikerustoo
Copy link
Contributor

ilikerustoo commented Feb 14, 2019

Right now using CodeCov and the following command pipenv run pytest -x -s --cov-config pytest.cov --cov-report term-missing --cov we are getting a total coverage of 58%. Previously we had low coverage due the incorrect configuration of coverall that checked coverage on the tests themselves this providing a falsely high code coverage.

We need more test cases that cover the rest of the code and this can be achieved by simply making tests for the missing statements/line below:

----------- coverage: platform linux, python 3.6.7-final-0 -----------
Name                        Stmts   Miss  Cover   Missing
---------------------------------------------------------
defaults.py                     5      0   100%
display.py                     22      4    82%   24-27
gatorgrouper.py                43     26    40%   25-82
group_random.py                50     20    60%   46-69
group_rrobin.py                55     24    56%   54-87
group_scoring.py               15      0   100%
parse_arguments.py             53     12    77%   94, 103, 116-128
read_student_file.py           18     13    28%   15-29
remove_absent_students.py      10      0   100%
spreadsheet.py                 35     28    20%   14-54
---------------------------------------------------------
TOTAL                         306    127    58%

We must aim for at least 80% coverage.

@Lancasterwu
Copy link
Contributor

Lancasterwu commented Feb 14, 2019

I am going to take a look on display.py 24 -27. @GatorEducator/team-lancaster

@everitt-andrew
Copy link
Contributor

I don't think we should work too much on coverage for spreadsheet.py as I am unsure of how different the file will be once we start using CSV files instead of Google Sheets integration.

@reibelj
Copy link
Contributor

reibelj commented Feb 14, 2019

I will look into parse_arguments.py lines 94, 103 and 116-128. @GatorEducator/team-lancaster

@thomad74
Copy link
Contributor

thomad74 commented Feb 14, 2019

Okay, I will take a look at read_student_file.py 15-29.

@wattob
Copy link
Contributor

wattob commented Feb 14, 2019

Hello @Lancasterwu, thank you for adding me to this issue. I will take a look at group_random.py 46-69.

@ALEXANDERB82
Copy link
Contributor

Alright @everitt-andrew and I will look into group_rrobin.py 54-87. @GatorEducator/team-lancaster

@everitt-andrew
Copy link
Contributor

In case anybody is having difficulties locating their test, those for group_random, group_rrobin, and gatorgrouper are found in the test_group_method.py file.

@Lancasterwu
Copy link
Contributor

display.py                     22      4    82%   24-27 

The line 24-27 is the function which provides the welcome message:

def display_welcome_message():
    """ Display a welcome message """
    print()
    print("GatorGrouper: Automatically Assign Students to Groups")
    print("https://github.com/GatorGrouper/gatorgrouper")
    print()

I think it is unnessesary to report in the coverage test. However, I put the following code to get the 100% coverage rate in display.py:

def test_display_welcome_message():
    """ Test if the welcome message can be displayed """
    assert display.display_welcome_message() == None

There is another error in @huangs1's repository. When I cloned it and try to run the coverage test locally, the pytest-cov told me there is an asserstion error in test_display_student_groups. I found out that it is due to the "Found %d students", place_counter. However, when I changed it to "Found " + str(place_counter) + " students" which is currently exactly same to the main repository, it passed pytest locally but it failed pylint when I push it to github.

@aubreypc
Copy link
Contributor

@Lancasterwu If I'm reading the build log correctly, it looks like the pylint error is:

tests/test_display.py:19:11: C0121: Comparison to None should be 'expr is None' (singleton-comparison)

I believe it's just a warning that since there's only ever one instance of the None object, but objects which are not None can still equal None, it is best to check that the expressions are identical in test cases:

    assert display.display_welcome_message() is None

@ilikerustoo
Copy link
Contributor Author

@lancaster let's meet to discuss the issue

@Lancasterwu
Copy link
Contributor

@ilikerustoo Sure.

@huangs1
Copy link
Contributor

huangs1 commented Feb 19, 2019

@Lancasterwu In case your team doesn't see this, please tell your team. I just spoke with our project manager @aubreypc and I was told that we should split up the team like this: one group of hypothesis testers, one group of regular testers, and one group that reviews the test cases. This way everyone knows what everyone else is doing. What are your thoughts on this?

@baldeosinghm
Copy link
Contributor

Currently looking into gatorgrouper.py lines 25-82

@libailong
Copy link

I am currently working on group_method with hypothesis tests.

@mmarconi
Copy link

Currently working on test_group_size with Hypothesis tests.

@yeej2
Copy link
Contributor

yeej2 commented Feb 19, 2019

Working with Matt on gatorgrouper.py lines 25-82

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment