Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 #!/usr/bin/env python
3 import os
4 import unittest
5 from manifestparser import TestManifest
7 here = os.path.dirname(os.path.abspath(__file__))
9 class TestTestManifest(unittest.TestCase):
10 """Test the Test Manifest"""
12 def test_testmanifest(self):
13 # Test filtering based on platform:
14 filter_example = os.path.join(here, 'filter-example.ini')
15 manifest = TestManifest(manifests=(filter_example,))
16 self.assertEqual([i['name'] for i in manifest.active_tests(os='win', disabled=False, exists=False)],
17 ['windowstest', 'fleem'])
18 self.assertEqual([i['name'] for i in manifest.active_tests(os='linux', disabled=False, exists=False)],
19 ['fleem', 'linuxtest'])
21 # Look for existing tests. There is only one:
22 self.assertEqual([i['name'] for i in manifest.active_tests()],
23 ['fleem'])
25 # You should be able to expect failures:
26 last_test = manifest.active_tests(exists=False, toolkit='gtk2')[-1]
27 self.assertEqual(last_test['name'], 'linuxtest')
28 self.assertEqual(last_test['expected'], 'pass')
29 last_test = manifest.active_tests(exists=False, toolkit='cocoa')[-1]
30 self.assertEqual(last_test['expected'], 'fail')
32 def test_comments(self):
33 """
34 ensure comments work, see
35 https://bugzilla.mozilla.org/show_bug.cgi?id=813674
36 """
37 comment_example = os.path.join(here, 'comment-example.ini')
38 manifest = TestManifest(manifests=(comment_example,))
39 self.assertEqual(len(manifest.tests), 8)
40 names = [i['name'] for i in manifest.tests]
41 self.assertFalse('test_0202_app_launch_apply_update_dirlocked.js' in names)
44 if __name__ == '__main__':
45 unittest.main()