-
Notifications
You must be signed in to change notification settings - Fork 913
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
Add coverage checking to the tests. #224
base: master
Are you sure you want to change the base?
Conversation
Running nosetests tests will now automatically generate a file .coverage in the root directory of the repo, containing coverage data. To compile this file into user friendly html, run coverage html from the root directory. Also added a flag to autograd/util.py to enable more comprehensive coverage checking.
I'm thinking about doing another 'spring cleaning' pr tidying up the tests a bit. I think the contents of test_binary_ops.py, test_numpy.py and test_scalar_ops.py should probably all be in one file. Then there are quite a few tests that are effectively duplicated within those three files, and tests which are only testing scalar functionality (in test_scalar_ops) which should be using unary_ufunc_check or binary_ufunc_check. |
For example, |
Changes Unknown when pulling 8c3e4e5 on j-towns:coverage into ** on HIPS:master**. |
I've disabled those autogenerated coveralls comments. |
Wow, awesome work here. Improving the tests and estimating coverage would be really valuable. The tests have saved me from committing bad or incomplete changes on many occasions. Is that estimate of the total test coverage accurate? I thought we had tests for pretty much every vjp and the core functionality as well, but maybe this total is including other code. |
Yeah you're right, it's not accurate at all. It only reflects code which is
run by the check_fun_and_grads function during testing.
Many tests use check_grads or instead. I thought that adding coverage
checking to check_grads by default would be a mistake because it would add
dependency on coverage.py to Autograd itself (as opposed to just the tests
- note the different locations of check_grads and check_fun_and_grads).
Maybe this distinction isn't important and coverage should be on in
check_grads by default.
You're correct about coverage - very nearly all the vjps appear to be
touched by the tests, the exceptions are things like conjugate, which is
just an alias for conj. However as I pointed out above some of the ufuncs
are being tested by (presumably old) scalar only tests.
…On Wed, 10 May 2017 at 18:00, Matthew Johnson ***@***.***> wrote:
Wow, awesome work here. Improving the tests and estimating coverage would
be really valuable. The tests have saved me from committing bad or
incomplete changes on many occasions.
Is that estimate of the total test coverage accurate? I thought we had
tests for pretty much every vjp and the core functionality as well, but
maybe this total is including other code.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#224 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AOjgu56Pb-TDH7uLMeIu07Kf3LmQ1hS-ks5r4e03gaJpZM4NWtCK>
.
|
Maybe one solution would be to move check_grads from autograd/util.py into
tests/numpy_utils.py, and turn on coverage checking there by default.
Then you could keep an alias to check_grads in util.py for backward
compatibility, which, when called, would have coverage checking turned off
by default.
Perhaps numpy_utils.py could then be renamed to testing_utils.py as well?
On Wed, 10 May 2017 at 19:32, Jamie Townsend <[email protected]>
wrote:
… Yeah you're right, it's not accurate at all. It only reflects code which
is run by the check_fun_and_grads function during testing.
Many tests use check_grads or instead. I thought that adding coverage
checking to check_grads by default would be a mistake because it would add
dependency on coverage.py to Autograd itself (as opposed to just the tests
- note the different locations of check_grads and check_fun_and_grads).
Maybe this distinction isn't important and coverage should be on in
check_grads by default.
You're correct about coverage - very nearly all the vjps appear to be
touched by the tests, the exceptions are things like conjugate, which is
just an alias for conj. However as I pointed out above some of the ufuncs
are being tested by (presumably old) scalar only tests.
On Wed, 10 May 2017 at 18:00, Matthew Johnson ***@***.***>
wrote:
> Wow, awesome work here. Improving the tests and estimating coverage would
> be really valuable. The tests have saved me from committing bad or
> incomplete changes on many occasions.
>
> Is that estimate of the total test coverage accurate? I thought we had
> tests for pretty much every vjp and the core functionality as well, but
> maybe this total is including other code.
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> <#224 (comment)>, or mute
> the thread
> <https://github.com/notifications/unsubscribe-auth/AOjgu56Pb-TDH7uLMeIu07Kf3LmQ1hS-ks5r4e03gaJpZM4NWtCK>
> .
>
|
I like the suggestions in your most recent comment (wow, has it already been 25 days?). I think it is important to have Maybe we can have an alias of |
Yeah actually doing it that way around makes more sense given what you've pointed out about the packages. I'll have a go at implementing that when I've got time (am pretty busy at the moment). |
86820fd
to
2f6cc22
Compare
Firstly, you'll now need to have the coverage module installed in order to run the tests.
Running
will now automatically generate a file .coverage in the root directory of the repo, containing coverage data.
To compile this file into user friendly html, run
from the root directory.
I've also added a flag variable to autograd/util.py to enable more comprehensive coverage checking.