vanvalenlab / deepcell-applications

Run DeepCell Applications
Other
8 stars 6 forks source link

Adding testing for argparse #22

Closed ngreenwald closed 3 years ago

ngreenwald commented 3 years ago

We currently don't test the argparse functionality in the repo. This PR moves the argparse function to utils and adds testing to make sure parameters are passed appropriately, and that errors are raised when required.

For the if __main__ code that's left in run_app.py, we could probably test that if we put it all in a function and that function got called within the block? Let me know what you think.

ngreenwald commented 3 years ago

The /private thing is a Mac OS specific folder location. On my machine it always appends it, testing via github never appends it.

ngreenwald commented 3 years ago

Got it. What about testing the code in the __main__ block? I realized that in my first couple PRs I never changed where get_arg_parser was being imported from, so the code would have failed if someone tried to run it. I could just put it all in a function and test the function? Or is there a way to have pytest look at it as is?

willgraf commented 3 years ago

We don't currently have a great way to test functions outside of the module.

We can pull more code into import-able functions and test those, but I think we're OK as-is.

ngreenwald commented 3 years ago

Yeah, good point. I switched the logic so that argparsing and running happens separately in the top level function