unittest - what is the best way to reuse test data?
42flicks at gmail.com
Wed Jun 3 05:21:10 EDT 2009
I'm writing an application that needs to fetch a json file from a webserver.
I'm writing the tests and have a question:
if I have the following methods:
headers = libary.get_data(data)
check header status
info = libary.get_info(libary.get_data(data))
This way I call the url twice, even though I have the data available from
the first test.
my application would just variables such as:
h = libary.get_data(data)
i = libary.get_info(h)
so only one call.
What is the best way to set up tests to resuse the data more? I'm new to
using the testing framework so I'm not sure on best practises and such.
Is introducing persistance by using sql lite the best way? I should be able
to just reuse data within the object. Or is my design wrong?
Any tips or suggestions would be appreciated!
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-list