~ubuntu-branches/ubuntu/raring/tracker/raring

« back to all changes in this revision

Viewing changes to tests/functional-tests/400-extractor.py

  • Committer: Package Import Robot
  • Author(s): Michael Biebl
  • Date: 2011-08-26 00:26:14 UTC
  • mfrom: (4.3.17 sid)
  • Revision ID: package-import@ubuntu.com-20110826002614-4qjfs9jhh5gs4p13
Tags: 0.10.24-1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
directory (containing xxx.expected files)
24
24
"""
25
25
from common.utils import configuration as cfg
26
 
from common.utils.helpers import ExtractorHelper
 
26
from common.utils.helpers import ExtractorHelper, NoMetadataException
27
27
import unittest2 as ut
28
28
import os
29
29
import types
118
118
        except Exception, e:
119
119
            self.fail ("%s in %s"
120
120
                       % (e, abs_description))
121
 
        result = self.extractor.get_metadata ("file://" + self.file_to_extract, "")
122
 
 
123
 
        self.__assert_extraction_ok (result)
 
121
 
 
122
        try:
 
123
            result = self.extractor.get_metadata ("file://" + self.file_to_extract, "")
 
124
 
 
125
            self.__assert_extraction_ok (result)
 
126
        except NoMetadataException, e:
 
127
            self.fail ("Probably a missing gstreamer plugin (or crash in the extractor?)")
124
128
 
125
129
 
126
130
    def assertDictHasKey (self, d, key, msg=None):
213
217
                                                          section))
214
218
 
215
219
 
216
 
if __name__ == "__main__":
 
220
def run_all ():
217
221
    ##
218
222
    # Traverse the TEST_DATA_PATH directory looking for .description files
219
223
    # Add a new TestCase to the suite per .description file and run the suite.
237
241
    result = ut.TextTestRunner (verbosity=1).run (extractionTestSuite)
238
242
    sys.exit(not result.wasSuccessful())
239
243
 
 
244
def run_one (filename):
 
245
    ##
 
246
    # Run just one .description file
 
247
    ##
 
248
    description = os.path.join (os.getcwd (), filename) 
 
249
 
 
250
    extractionTestSuite = ut.TestSuite ()
 
251
    tc = ExtractionTestCase(descfile=description)
 
252
    extractionTestSuite.addTest(tc)
 
253
 
 
254
    result = ut.TextTestRunner (verbosity=2).run (extractionTestSuite)
 
255
    sys.exit(not result.wasSuccessful())
 
256
 
 
257
 
 
258
if __name__ == "__main__":
 
259
    if (len (sys.argv) == 1):
 
260
        run_all ()
 
261
    else:
 
262
        if os.path.exists (sys.argv[1]) and sys.argv[1].endswith (".expected"):
 
263
            run_one (sys.argv[1])
 
264
        else:
 
265
            print "Usage: %s [FILE.expected]" % (sys.argv[0])
 
266