Bug 1087682 - Add a manifestparser test for the case where there is no manifest. r=jgriffin
authorPankaj Malhotra(:bitgeeky) <mozpankaj1994@gmail.com>
Tue, 04 Nov 2014 04:16:00 +0100
changeset 214032 370927f1465a65fe8b2a4aa6b9a911a689ebe293
parent 214031 27c0521e84741ce1fa68a21aad87dce9c5414625
child 214033 196228507e75012c242a82ce5afe5e60a2635c03
push id51398
push usercbook@mozilla.com
push dateWed, 05 Nov 2014 07:54:15 +0000
treeherdermozilla-inbound@370927f1465a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgriffin
bugs1087682
milestone36.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1087682 - Add a manifestparser test for the case where there is no manifest. r=jgriffin
testing/mozbase/manifestparser/tests/test_testmanifest.py
--- a/testing/mozbase/manifestparser/tests/test_testmanifest.py
+++ b/testing/mozbase/manifestparser/tests/test_testmanifest.py
@@ -3,16 +3,17 @@
 import os
 import shutil
 import tempfile
 import unittest
 from manifestparser import TestManifest, ParseError
 
 here = os.path.dirname(os.path.abspath(__file__))
 
+
 class TestTestManifest(unittest.TestCase):
     """Test the Test Manifest"""
 
     def test_testmanifest(self):
         # Test filtering based on platform:
         filter_example = os.path.join(here, 'filter-example.ini')
         manifest = TestManifest(manifests=(filter_example,), strict=False)
         self.assertEqual([i['name'] for i in manifest.active_tests(os='win', disabled=False, exists=False)],
@@ -40,17 +41,16 @@ class TestTestManifest(unittest.TestCase
         missing_path = os.path.join(here, 'missing-path.ini')
         manifest = TestManifest(manifests=(missing_path,), strict=True)
         self.assertRaises(IOError, manifest.active_tests)
         self.assertRaises(IOError, manifest.copy, tempdir)
         self.assertRaises(IOError, manifest.update, tempdir)
 
         shutil.rmtree(tempdir)
 
-
     def test_comments(self):
         """
         ensure comments work, see
         https://bugzilla.mozilla.org/show_bug.cgi?id=813674
         """
         comment_example = os.path.join(here, 'comment-example.ini')
         manifest = TestManifest(manifests=(comment_example,))
         self.assertEqual(len(manifest.tests), 8)
@@ -98,10 +98,23 @@ class TestTestManifest(unittest.TestCase
                                                     options=AttributeDict(options),
                                                     **info)), 5)
 
         # test for illegal subsuite value
         manifest.tests[0]['subsuite'] = 'subsuite=bar,foo=="bar",type="nothing"'
         self.assertRaises(ParseError, manifest.active_tests, exists=False,
                           options=AttributeDict(options), **info)
 
+    def test_none_and_empty_manifest(self):
+        """
+        Test TestManifest for None and empty manifest, see
+        https://bugzilla.mozilla.org/show_bug.cgi?id=1087682
+        """
+        none_manifest = TestManifest(manifests=None, strict=False)
+        self.assertEqual(len(none_manifest.test_paths()), 0)
+        self.assertEqual(len(none_manifest.active_tests()), 0)
+
+        empty_manifest = TestManifest(manifests=[], strict=False)
+        self.assertEqual(len(empty_manifest.test_paths()), 0)
+        self.assertEqual(len(empty_manifest.active_tests()), 0)
+
 if __name__ == '__main__':
     unittest.main()