MangoTheCat / testCoverage

R Code Coverage Package
https://www.mango-solutions.com/blog/analyzing-coverage-of-r-unit-tests-in-packages-the-testcoverage-package
BSD 3-Clause Clear License
33 stars 8 forks source link

0 coverage for dendextend?! #2

Closed talgalili closed 10 years ago

talgalili commented 10 years ago

Hi all, Thank you for this cool package.

When I try it on my package:

library(testthat)
library(testCoverage)
cranCoverage("dendextend")

I get 0 coverage, even though the package has many tests (using testthat).

Any idea as to why that is / how to solve it?

Thanks, Tal

MangoTheCat commented 10 years ago

This issue is due to the package having a function .onAttach which is not currently supported.

Note that there is no reason to suppose that .onAttach will not work, just that we do not currently cover this use case in our requirements and testing. Here it appears that the function is not behaving as expected because of explicit call to dendextend::dendextend_get_branches_heights. We could mask :: in the same way as ::: to catch this syntax. setHook may also need to be masked. utils::packageDescription("dendextend") is also a syntax that may be tricky to handle.

Thanks to @ttaverner for helpful discussion and patches.

MangoTheCat commented 10 years ago

As a workaround, install and require the package, then require testCoverage, then run cranCoverage.

talgalili commented 10 years ago

Thanks, it now seems to work for me (although I will probably need to go through it step by step to see what it might have missed).

It looks great - thanks again :+1: