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
Deciding for a testing policy #67
Comments
Why should our policy be different to Theano's? They seem to have plenty of contributors. |
Um, if I may chime in: in my experience with experienced/productive developers, the absence of testing can be much scarier (and thus be a barrier) than strictness: If you have full unit tests, full regression tests for bugfixes and rudimentary smoke tests that cover common usecases (by verifying that they run through), then you can be pretty much sure not to break anything existing by simply getting all the tests to pass in your contribution branch. If this is guaranteed, then it gives a feeling of safety that is worth quite a lot IMO. By its very nature, this package should always have very easy to unit test building blocks, so it shouldn't really be that much effort to do it properly. Often one can also compare to a numpy/scipy version of the same functionality. Also, as a more and more regular user (and contributor if I find something that I can be useful for) of this toolbox, I like the feeling to be able to rely on it working, and testably so ... In any case, I'd be very very very wary of potential code rot and the broken window effect: If you decide now to be relaxed on testing, it will be very difficult to change policies later on. It may also be a point of distinction to other python dl packages that are cropping up here and there, to be able to say yes, we do all that, but we also have tests. For new contributors this may also be a great opportunity to learn good practice ... Following @dnouri s comment: There doesn't seem to be a problem with contributor numbers in sklearn either. |
All good points. Then I guess we need some kind of code sprint to get the current code base up to speed with tests. We can't expect contributors to provide tests if we don't do it ourselves :) And I guess the same thing goes for documentation, actually. |
Cool. Yes, let's try to improve that test and docs coverage. I've been falling behind a little bit lately. But I think in the meantime we can ask contributors to add tests for new stuff where tests for that class already exist, and update docs where they're already written. |
Yes, I totally agree with that. I cannot stand outdated docstrings, and I feel bad when modifying undocumented code. I will try to develop the same strong feelings for tests. About the "this might put up a barrier for new contributors" argument: We don't have to force contributors to add all the tests and docstrings that come to our mind when reading a PR, we can ask them nicely, and do them ourselves if they're not able to comply and the contribution is worth it. There's a nice article about that: http://blog.spreedly.com/2014/06/24/merge-pull-request-considered-harmful (the first section). I guess that could be a good compromise between being overly strict with contributors and inviting the broken window effect. |
Very good read! I agree that that's a good compromise. |
To chime in with my experience from maintaining Luigi: I think in fact it actually lowers the barrier for contribution since the tests provide a safety guarantee. A ratio of 1:1 in terms of line count is generally a good goal. |
Regarding the 1:1 ratio: There's also Python's nice coverage module, which can be easily used with py.test. It shows you which lines of your production code weren't executed by any of the tests. |
Sounds like this could actually be useful to track our progress writing tests for the base library so far. Can this be integrated into our current setup with travis? |
There's coveralls which can be integrated into Travis CI. scikit-learn uses that, for example. |
coveralls looks cool, never tried it. I just checked in something that prints out a coverage report at the end of every test run. Right now it looks pretty messy. ;-)
|
I think our policy has been pretty much decided, we want pull requests to come with tests as much as possible (and if they don't we should encourage the submitter to add them, or add them ourselves before merging). So I'll close this issue. The first step to implementing this policy is getting our test coverage up to an acceptable level, so contributors will be encouraged to write tests themselves as well. I made a new issue for this: #112. |
Disucssion started in #66:
@dnouri said: "At some point we should make a decision about whether or not we're committing to tests. If we want tests, then pull requests that add functionality should add tests, too. get_output is (was) thoroughly tested, thus adding a test for this extra feature is trivial."
@benanne responded: "On the one hand tests are obviously a great thing to have - on the other hand they may create a bit of a barrier for potential contributors. I think it might actually be a good idea to require tests for modifications to core functionality like this one, but if someone decides to add a new layer class or something, maybe we shouldn't be so strict. We should probably flesh out an official policy, maybe we can create a separate issue for it."
Let's continue the discussion here.
The text was updated successfully, but these errors were encountered: