|
1 #!/usr/bin/env python |
|
2 |
|
3 import os |
|
4 import unittest |
|
5 from manifestparser import TestManifest |
|
6 |
|
7 here = os.path.dirname(os.path.abspath(__file__)) |
|
8 |
|
9 class TestTestManifest(unittest.TestCase): |
|
10 """Test the Test Manifest""" |
|
11 |
|
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']) |
|
20 |
|
21 # Look for existing tests. There is only one: |
|
22 self.assertEqual([i['name'] for i in manifest.active_tests()], |
|
23 ['fleem']) |
|
24 |
|
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') |
|
31 |
|
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) |
|
42 |
|
43 |
|
44 if __name__ == '__main__': |
|
45 unittest.main() |