Closed hectormz closed 5 years ago
This is a very useful issue that you've raised, @HectorM14!
I'm looking into how to get codecov working properly here, so that we can ensure that there's high test coverage in the codebase.
@HectorM14 just wanted to let you know, I just enabled codecov for this repo!
Cool, what are the practicalities @ericmjl? It generates a report on increase/decrease of coverage, and a maintainer decides, or will it fail the build if there's a decrease in coverage?
It's definitely "maintainer decides". Lowered test coverage is a good flag that something was not caught, if a new feature was added.
Got it, it was a quick addition!
Yeah! As it turns out, the first time I set it up and failed, I just... didn't read the docs properly :smile:.
I looked into the chemistry tests, and it appears that the issue is the "skipif" decorator that runs the rdkit tests only during CI. I commented these out, and the coverage jumped up to 85%. The only coverage that is missing is now several Raise statements and verifying the tqdm progress bar on smiles2mol. The tests only took 0.68 seconds with rdkit operations run on test data, so it may be worth either removing the "skipif" decorator, or only triggering coverage testing on continuous integration. Let me know your thoughts on this.
Thanks for the input, @dendrondal! Here are my responses inline.
...so it may be worth either removing the "skipif" decorator, or only triggering coverage testing on continuous integration.
Perhaps a bit of background may help explain why the skipif
decorator exists. It was added because some sprinters didn't want to install a full cheminformatics + bioinformatics suite of tools just to hack on the core of pyjanitor. As such, we added the skipif
decorator to let the tests pass there. I think the more relevant thing would be to explain why the skipif decorator exists in the code itself.
The only coverage that is missing is now several Raise statements and verifying the tqdm progress bar on smiles2mol
Definitely, some tests that trigger the raise
statements would be great. As for triggering tqdm
progress bar, if it's too difficult to test, we can worry about it later. It's a nice UI/UX thing, but definitely not core.
That makes a lot of sense, actually, since a pretty small subset of users will need to use RDKit. It sounds like so long as RDKit is used as part of the CI pipeline, it won't affect your coverage.
I'm currently working on coverage improvement for chemistry, finance, and functions. I've been able to get finance's coverage up to 89% and chemistry to 86%, and everything missed appears to be either intermediate variables within functions, completely outside of functions, or tqdm-related. Still working on functions, given the massive size, but it's currently showing 93%.
Cool stuff. Thanks, @dendrondal! Looking forward to seeing the PR.
While updating function argument names, I came across a function without a test, and was curious what other functions didn't have tests. I ran the
pytest coverage
plugin and got the following results.This tells us which lines are not covered, but more importantly I wanted to know which functions have no coverage at all. Does anyone know how to get that answer? For the most part, the large blocks of code are functions that have no coverage:
Overall, we have a test for at least some part of most functions, but
chemistry
doesn't have any, and there are a few in the mainfunctions
that are lacking.This issue serves to identify functions that folks can write tests for, and discuss coverage.