1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/testing/mozbase/manifestdestiny/tests/test_default_skipif.py Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,36 @@ 1.4 +#!/usr/bin/env python 1.5 + 1.6 +# This Source Code Form is subject to the terms of the Mozilla Public 1.7 +# License, v. 2.0. If a copy of the MPL was not distributed with this file, 1.8 +# You can obtain one at http://mozilla.org/MPL/2.0/. 1.9 + 1.10 +import os 1.11 +import unittest 1.12 +from manifestparser import ManifestParser 1.13 + 1.14 +here = os.path.dirname(os.path.abspath(__file__)) 1.15 + 1.16 +class TestDefaultSkipif(unittest.TestCase): 1.17 + """test applying a skip-if condition in [DEFAULT] and || with the value for the test""" 1.18 + 1.19 + 1.20 + def test_defaults(self): 1.21 + 1.22 + default = os.path.join(here, 'default-skipif.ini') 1.23 + parser = ManifestParser(manifests=(default,)) 1.24 + for test in parser.tests: 1.25 + if test['name'] == 'test1': 1.26 + self.assertEqual(test['skip-if'], "(os == 'win' && debug ) || (debug)") 1.27 + elif test['name'] == 'test2': 1.28 + self.assertEqual(test['skip-if'], "(os == 'win' && debug ) || (os == 'linux')") 1.29 + elif test['name'] == 'test3': 1.30 + self.assertEqual(test['skip-if'], "(os == 'win' && debug ) || (os == 'win')") 1.31 + elif test['name'] == 'test4': 1.32 + self.assertEqual(test['skip-if'], "(os == 'win' && debug ) || (os == 'win' && debug)") 1.33 + elif test['name'] == 'test5': 1.34 + self.assertEqual(test['skip-if'], "os == 'win' && debug # a pesky comment") 1.35 + elif test['name'] == 'test6': 1.36 + self.assertEqual(test['skip-if'], "(os == 'win' && debug ) || (debug )") 1.37 + 1.38 +if __name__ == '__main__': 1.39 + unittest.main()