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 #10

Closed
ashwinvis opened this issue Oct 3, 2021 · 4 comments
Closed

Low code coverage #10

ashwinvis opened this issue Oct 3, 2021 · 4 comments

Comments

@ashwinvis
Copy link

If I run

❯ pytest --cov=fluxdataqaqc tests/
==================================== test session starts ====================================
platform linux -- Python 3.8.9, pytest-6.2.5, py-1.10.0, pluggy-1.0.0
rootdir: /home/avmo/src/sandbox/flux-data-qaqc, configfile: pytest.ini
plugins: cov-2.12.1, nbval-0.9.6
collected 11 items                                                                          

tests/test_fluxdataqaqc.py ...........                                                [100%]

----------- coverage: platform linux, python 3.8.9-final-0 -----------
Name                       Stmts   Miss  Cover
----------------------------------------------
fluxdataqaqc/__init__.py       8      0   100%
fluxdataqaqc/data.py         488    114    77%
fluxdataqaqc/plot.py         552    290    47%
fluxdataqaqc/qaqc.py         663    619     7%
fluxdataqaqc/util.py          90     60    33%
----------------------------------------------
TOTAL                       1801   1083    40%


==================================== 11 passed in 21.02s ====================================

I notice that the tests mostly target only the data module. If the tutorials cover the rest then it should be good enough and one could check the coverage as follows.

❯ cd examples/Basic_usage
❯ pytest --cov=fluxdataqaqc --nbval Tutorial.ipynb ../../tests/

However, in order to do that, #9 should be fixed first.

@ashwinvis
Copy link
Author

The code coverage is up to 72% if we include the tutorial. Of course this is not an automated unit test and there is room for improvement. For the purpose of this review (openjournals/joss-reviews#3418) this is satisfactory.

You could pursue this further in the future @JohnVolk.

@ashwinvis
Copy link
Author

Note: Bokeh causes outputs to change, so I used the --nbval-lax instead.

pytest --cov=fluxdataqaqc --cov-report=html --nbval-lax -v Tutorial.ipynb ../../tests/

@JohnVolk
Copy link
Collaborator

JohnVolk commented Oct 5, 2021

Thanks for the info @ashwinvis I wasn't aware of this plugin and the options, it is really useful. I was also having issues with the --cov option on the notebooks. Yes, I plan on flushing out the automated tests.

@ashwinvis
Copy link
Author

I used the plugins pytest-cov (coverage) and nbval (notebook testing), as you might have figured out already.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants