testing/mozbase/manifestdestiny/tests/test_default_skipif.py

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:b2dcdcf0756c
1 #!/usr/bin/env python
2
3 # This Source Code Form is subject to the terms of the Mozilla Public
4 # License, v. 2.0. If a copy of the MPL was not distributed with this file,
5 # You can obtain one at http://mozilla.org/MPL/2.0/.
6
7 import os
8 import unittest
9 from manifestparser import ManifestParser
10
11 here = os.path.dirname(os.path.abspath(__file__))
12
13 class TestDefaultSkipif(unittest.TestCase):
14 """test applying a skip-if condition in [DEFAULT] and || with the value for the test"""
15
16
17 def test_defaults(self):
18
19 default = os.path.join(here, 'default-skipif.ini')
20 parser = ManifestParser(manifests=(default,))
21 for test in parser.tests:
22 if test['name'] == 'test1':
23 self.assertEqual(test['skip-if'], "(os == 'win' && debug ) || (debug)")
24 elif test['name'] == 'test2':
25 self.assertEqual(test['skip-if'], "(os == 'win' && debug ) || (os == 'linux')")
26 elif test['name'] == 'test3':
27 self.assertEqual(test['skip-if'], "(os == 'win' && debug ) || (os == 'win')")
28 elif test['name'] == 'test4':
29 self.assertEqual(test['skip-if'], "(os == 'win' && debug ) || (os == 'win' && debug)")
30 elif test['name'] == 'test5':
31 self.assertEqual(test['skip-if'], "os == 'win' && debug # a pesky comment")
32 elif test['name'] == 'test6':
33 self.assertEqual(test['skip-if'], "(os == 'win' && debug ) || (debug )")
34
35 if __name__ == '__main__':
36 unittest.main()

mercurial