examples/aubiopitch.py: also print line number and write output file if exception
authorPaul Brossier <piem@piem.org>
Fri, 23 Nov 2007 12:32:13 +0000 (13:32 +0100)
committerPaul Brossier <piem@piem.org>
Fri, 23 Nov 2007 12:32:13 +0000 (13:32 +0100)
tests/python/examples/aubiopitch.py

index 356daa22f44c72a0ed21f56c004a082d3d2253e1..1218fb47c201785449b7db54986a86e480709bc9 100644 (file)
@@ -52,7 +52,13 @@ class aubiopitch_test_yinfft(program_test_case):
     """ test aubiopitch with default parameters """
     self.getOutput()
     expected_output = open(os.path.join('examples','aubiopitch','yinfft'+'.'+os.path.basename(self.filename)+'.txt')).read()
+    lines = 0
     for line_out, line_exp in zip(self.output.split('\n'), expected_output.split('\n')):
-      assert line_out == line_exp, line_exp + " vs. " + line_out
+      try:
+        assert line_exp == line_out, line_exp + " vs. " + line_out + " at line " + str(lines)
+      except:
+        open(os.path.join('examples','aubiopitch','yinfft'+'.'+os.path.basename(self.filename)+'.txt.out'),'w').write(self.output)
+        raise
+      lines += 1
 
 if __name__ == '__main__': unittest.main()