1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/testing/mozbase/manifestdestiny/tests/test_testmanifest.py Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,45 @@ 1.4 +#!/usr/bin/env python 1.5 + 1.6 +import os 1.7 +import unittest 1.8 +from manifestparser import TestManifest 1.9 + 1.10 +here = os.path.dirname(os.path.abspath(__file__)) 1.11 + 1.12 +class TestTestManifest(unittest.TestCase): 1.13 + """Test the Test Manifest""" 1.14 + 1.15 + def test_testmanifest(self): 1.16 + # Test filtering based on platform: 1.17 + filter_example = os.path.join(here, 'filter-example.ini') 1.18 + manifest = TestManifest(manifests=(filter_example,)) 1.19 + self.assertEqual([i['name'] for i in manifest.active_tests(os='win', disabled=False, exists=False)], 1.20 + ['windowstest', 'fleem']) 1.21 + self.assertEqual([i['name'] for i in manifest.active_tests(os='linux', disabled=False, exists=False)], 1.22 + ['fleem', 'linuxtest']) 1.23 + 1.24 + # Look for existing tests. There is only one: 1.25 + self.assertEqual([i['name'] for i in manifest.active_tests()], 1.26 + ['fleem']) 1.27 + 1.28 + # You should be able to expect failures: 1.29 + last_test = manifest.active_tests(exists=False, toolkit='gtk2')[-1] 1.30 + self.assertEqual(last_test['name'], 'linuxtest') 1.31 + self.assertEqual(last_test['expected'], 'pass') 1.32 + last_test = manifest.active_tests(exists=False, toolkit='cocoa')[-1] 1.33 + self.assertEqual(last_test['expected'], 'fail') 1.34 + 1.35 + def test_comments(self): 1.36 + """ 1.37 + ensure comments work, see 1.38 + https://bugzilla.mozilla.org/show_bug.cgi?id=813674 1.39 + """ 1.40 + comment_example = os.path.join(here, 'comment-example.ini') 1.41 + manifest = TestManifest(manifests=(comment_example,)) 1.42 + self.assertEqual(len(manifest.tests), 8) 1.43 + names = [i['name'] for i in manifest.tests] 1.44 + self.assertFalse('test_0202_app_launch_apply_update_dirlocked.js' in names) 1.45 + 1.46 + 1.47 +if __name__ == '__main__': 1.48 + unittest.main()