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

fixing docs to remind folks to make sure tests fail for the right reasons #971

Merged
merged 5 commits into from
Apr 15, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
2015-04-15 Susan Steinman <steinman.tutoring@gmail.com>

* khmer/tests/khmer_tst_utils.py,doc/dev/a-quick-guide-to-testing.rst
edited docstring and docs to remind people to make sure tests test
errors correctly

2015-04-15 Michael R. Crusoe <mcrusoe@msu.edu>

* sandbox/make-coverage.py: tweak for importability
Expand Down
5 changes: 5 additions & 0 deletions doc/dev/a-quick-guide-to-testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ We suggest the following approach to writing tests for **new code**:
your code -- if statements, fence-post bound errors, etc. -- and write
tests that exercise those bits of code specifically.

#. Make sure tests that expect a function call to fail (esp. with
fail_ok=True) are failing for the expected reason. Run the code from the
command line and see what the behavior is. For troubleshooting tests,
catch the error with try: ... except: or print err.

For adding tests to **old code**, we recommend a mix of two approaches:

#. use `"stupidity driven testing"
Expand Down
2 changes: 2 additions & 0 deletions tests/khmer_tst_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ def runscript(scriptname, args, in_directory=None,

Run the given Python script, with the given args, in the given directory,
using 'execfile'.

When using :attr:`fail_ok`=False in tests, specify the expected error.
"""
sysargs = [scriptname]
sysargs.extend(args)
Expand Down