-
Notifications
You must be signed in to change notification settings - Fork 80
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 tests in tests/test_sourmash.py
for the function load_pathlist_from_file
#1430
Comments
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Copied from #1423 comment - in terms of actual tests, please see this example for the kind of thing you want to do - create a list of files that's broken in various ways, and then use the actual function |
tests/test_sourmash.py
for the function load_pathlist_from_file
tests/test_sourmash.py
for the function load_pathlist_from_file
@ctb Is there a specific block where I need to add these tests in |
no hard and fast rules - generally I try to group tests together in the file by what they're testing, but as long as the names are sensible, it doesn't matter. |
@ctb @luizirber I'm not sure about how to get started on writing the tests. Could you provide some tips? |
hi @keyabarve - I'm thinking about a blog post on testing, but in the meantime... let's say the goal is to write a test to ensure that what happens when the user provides an empty pathlist file makes sense. we don't really have any firm expectations for what this would look like, but a good rule is that probably you don't want to have the user see an exception being raised (so you want a nice error message!), and you also want to avoid errors or exceptions that are incidental (i.e. the exception being raised is not obviously related to the contents of the pathlist file.) first, note that on the command line if you do something like # make an empty file
touch empty.txt
# try loading it as a pathlist
sourmash search tests/test-data/47.fa.sig empty.txt you get an ugly error that violates all of my rules above. so clearly some work here is needed! (I suspected as much when I created this issue... the pathlist code is simple and ugly!) I'm pretty used to writing tests for py.test now, but I still sometimes write some standalone Python code first to explore behavior. try creating a .py file,
this should generate an error (make sure (This is basically just a reminder that you can always just poke and prod at this in Python or via the command line.) So, once you've gotten that code running and failing, your next task is to put this into a standalone test format that py.test can run. I almost always start a new test by copying an old one, which is appropriate in this case! Check out
so to get started on this issue,
For bonus points, go look at the HTH! |
#1423 partly fixes issue #1369; this issue is for the remaining bit of #1369.
Please add some Python unit tests in
tests/test_sourmash.py
for theload_pathlist_from_file
function, including empty file list, badly formatted ones, ones with duplicates.The text was updated successfully, but these errors were encountered: