Index: sodar/branches/scintec-branch/sodar/tests/suite.py =================================================================== --- (revision ) +++ sodar/branches/scintec-branch/sodar/tests/suite.py (revision 254) @@ -1,0 +1,52 @@ +""" +Test suite for the sodar package. +""" + +__author__ = 'Chris Calloway' +__email__ = 'cbc@chriscalloway.org' +__copyright__ = 'Copyright 2009 UNC-CH Department of Marine Science' +__license__ = 'GPL2' + +import os +import unittest +import doctest + +def setUpData(data_dir,data_file): + """ + Get data from test file. + + setUpData(data_dir,data_file) -> str + + Where data_dir is a str representation of a relative path in test/data, and + data_file is a str representation of a data file within data_dir + """ + + module_dir = os.path.abspath(os.path.dirname(__file__)) + data_file = os.path.join(module_dir,'data',data_dir,data_file) + data = open(data_file).read() + return data + +def setUpGoodMndData(): + """ + Get data from a known good Scintec .mnd file. + """ + + return setUpData(os.path.join('scintec','good',),'091117.mnd') + +def setUpGoodMnd(test): + """ + Test set up for a good Scintec .mnd file. + """ + + mnd = setUpGoodMndData() + test.globs.update(good_mnd=mnd) + +def test_suite(): + """ + Return unittest.TestSuite for setup.py test. + """ + + suite = [] + suite.append(doctest.DocTestSuite(module='sodar.scintec.maindata', + setUp=setUpGoodMnd)) + return unittest.TestSuite(suite)