]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Tests/CheckPythonSyntax.py
Sync BaseTool trunk (version r2649) into EDKII BaseTools.
[mirror_edk2.git] / BaseTools / Tests / CheckPythonSyntax.py
index e27c341c0ca8db4bb920867075478178c64b17a2..61a048ad5d054b84c2be68c08fb231cdb3cc320b 100644 (file)
@@ -1,74 +1,74 @@
-## @file
-#  Unit tests for checking syntax of Python source code
-#
-#  Copyright (c) 2009, Intel Corporation. All rights reserved.<BR>
-#
-#  This program and the accompanying materials
-#  are licensed and made available under the terms and conditions of the BSD License
-#  which accompanies this distribution.  The full text of the license may be found at
-#  http://opensource.org/licenses/bsd-license.php
-#
-#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-#  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-
-##
-# Import Modules
-#
-import os
-import unittest
-import py_compile
-
-import TestTools
-
-class Tests(TestTools.BaseToolsTest):
-
-    def setUp(self):
-        TestTools.BaseToolsTest.setUp(self)
-
-    def SingleFileTest(self, filename):
-        try:
-            py_compile.compile(filename, doraise=True)
-        except Exception, e:
-            self.fail('syntax error: %s, Error is %s' % (filename, str(e)))
-
-def MakePythonSyntaxCheckTests():
-    def GetAllPythonSourceFiles():
-        pythonSourceFiles = []
-        for (root, dirs, files) in os.walk(TestTools.PythonSourceDir):
-            for filename in files:
-                if filename.lower().endswith('.py'):
-                    pythonSourceFiles.append(
-                            os.path.join(root, filename)
-                        )
-        return pythonSourceFiles
-
-    def MakeTestName(filename):
-        assert filename.lower().endswith('.py')
-        name = filename[:-3]
-        name = name.replace(TestTools.PythonSourceDir, '')
-        name = name.replace(os.path.sep, '_')
-        return 'test' + name
-
-    def MakeNewTest(filename):
-        test = MakeTestName(filename)
-        newmethod = lambda self: self.SingleFileTest(filename)
-        setattr(
-            Tests,
-            test, 
-            newmethod
-            )
-
-    for filename in GetAllPythonSourceFiles():
-        MakeNewTest(filename)
-
-MakePythonSyntaxCheckTests()
-del MakePythonSyntaxCheckTests
-
-TheTestSuite = TestTools.MakeTheTestSuite(locals())
-
-if __name__ == '__main__':
-    allTests = TheTestSuite()
-    unittest.TextTestRunner().run(allTests)
-
-
+## @file\r
+#  Unit tests for checking syntax of Python source code\r
+#\r
+#  Copyright (c) 2009, Intel Corporation. All rights reserved.<BR>\r
+#\r
+#  This program and the accompanying materials\r
+#  are licensed and made available under the terms and conditions of the BSD License\r
+#  which accompanies this distribution.  The full text of the license may be found at\r
+#  http://opensource.org/licenses/bsd-license.php\r
+#\r
+#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+#  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+#\r
+\r
+##\r
+# Import Modules\r
+#\r
+import os\r
+import unittest\r
+import py_compile\r
+\r
+import TestTools\r
+\r
+class Tests(TestTools.BaseToolsTest):\r
+\r
+    def setUp(self):\r
+        TestTools.BaseToolsTest.setUp(self)\r
+\r
+    def SingleFileTest(self, filename):\r
+        try:\r
+            py_compile.compile(filename, doraise=True)\r
+        except Exception, e:\r
+            self.fail('syntax error: %s, Error is %s' % (filename, str(e)))\r
+\r
+def MakePythonSyntaxCheckTests():\r
+    def GetAllPythonSourceFiles():\r
+        pythonSourceFiles = []\r
+        for (root, dirs, files) in os.walk(TestTools.PythonSourceDir):\r
+            for filename in files:\r
+                if filename.lower().endswith('.py'):\r
+                    pythonSourceFiles.append(\r
+                            os.path.join(root, filename)\r
+                        )\r
+        return pythonSourceFiles\r
+\r
+    def MakeTestName(filename):\r
+        assert filename.lower().endswith('.py')\r
+        name = filename[:-3]\r
+        name = name.replace(TestTools.PythonSourceDir, '')\r
+        name = name.replace(os.path.sep, '_')\r
+        return 'test' + name\r
+\r
+    def MakeNewTest(filename):\r
+        test = MakeTestName(filename)\r
+        newmethod = lambda self: self.SingleFileTest(filename)\r
+        setattr(\r
+            Tests,\r
+            test, \r
+            newmethod\r
+            )\r
+\r
+    for filename in GetAllPythonSourceFiles():\r
+        MakeNewTest(filename)\r
+\r
+MakePythonSyntaxCheckTests()\r
+del MakePythonSyntaxCheckTests\r
+\r
+TheTestSuite = TestTools.MakeTheTestSuite(locals())\r
+\r
+if __name__ == '__main__':\r
+    allTests = TheTestSuite()\r
+    unittest.TextTestRunner().run(allTests)\r
+\r
+\r