|
@@ -0,0 +1,99 @@
|
|
|
+#
|
|
|
+# Metrix++, Copyright 2009-2013, Metrix++ Project
|
|
|
+# Link: http://metrixplusplus.sourceforge.net
|
|
|
+#
|
|
|
+# This file is a part of Metrix++ Tool.
|
|
|
+#
|
|
|
+# Metrix++ is free software: you can redistribute it and/or modify
|
|
|
+# it under the terms of the GNU General Public License as published by
|
|
|
+# the Free Software Foundation, version 3 of the License.
|
|
|
+#
|
|
|
+# Metrix++ is distributed in the hope that it will be useful,
|
|
|
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
+# GNU General Public License for more details.
|
|
|
+#
|
|
|
+# You should have received a copy of the GNU General Public License
|
|
|
+# along with Metrix++. If not, see <http://www.gnu.org/licenses/>.
|
|
|
+#
|
|
|
+
|
|
|
+
|
|
|
+import unittest
|
|
|
+import os
|
|
|
+
|
|
|
+import tests.common
|
|
|
+
|
|
|
+class Test(tests.common.TestCase):
|
|
|
+
|
|
|
+ def test_basic(self):
|
|
|
+
|
|
|
+ #
|
|
|
+ # WARNING:
|
|
|
+ # files generated by this test are used by project documents page
|
|
|
+ # so, if the test is changed, html docs should be updated accordingly
|
|
|
+ #
|
|
|
+ METRIXPLUSPLUS_PATH = None
|
|
|
+ if 'METRIXPLUSPLUS_PATH' in os.environ.keys():
|
|
|
+ METRIXPLUSPLUS_PATH = os.environ['METRIXPLUSPLUS_PATH']
|
|
|
+
|
|
|
+ os.environ['METRIXPLUSPLUS_PATH'] = os.path.join(os.path.dirname(os.path.abspath(__file__)),
|
|
|
+ 'test_api_tutorial', 'ext', 'step1')
|
|
|
+ runner = tests.common.ToolRunner('collect',
|
|
|
+ ['--log-level=INFO'],
|
|
|
+ prefix='step1',
|
|
|
+ check_stderr=[(0, -1)])
|
|
|
+ self.assertExec(runner.run())
|
|
|
+
|
|
|
+ os.environ['METRIXPLUSPLUS_PATH'] = os.path.join(os.path.dirname(os.path.abspath(__file__)),
|
|
|
+ 'test_api_tutorial', 'ext', 'step2')
|
|
|
+ runner = tests.common.ToolRunner('collect',
|
|
|
+ ['--log-level=INFO',
|
|
|
+ '--myext.magic.numbers'],
|
|
|
+ prefix='step2',
|
|
|
+ check_stderr=[(0, -1)])
|
|
|
+ self.assertExec(runner.run())
|
|
|
+
|
|
|
+ os.environ['METRIXPLUSPLUS_PATH'] = os.path.join(os.path.dirname(os.path.abspath(__file__)),
|
|
|
+ 'test_api_tutorial', 'ext', 'step3')
|
|
|
+ runner = tests.common.ToolRunner('collect',
|
|
|
+ ['--log-level=INFO',
|
|
|
+ '--myext.magic.numbers'],
|
|
|
+ prefix='step3',
|
|
|
+ check_stderr=[(0, -1)])
|
|
|
+ self.assertExec(runner.run())
|
|
|
+
|
|
|
+ os.environ['METRIXPLUSPLUS_PATH'] = os.path.join(os.path.dirname(os.path.abspath(__file__)),
|
|
|
+ 'test_api_tutorial', 'ext', 'step4')
|
|
|
+ runner = tests.common.ToolRunner('collect',
|
|
|
+ ['--log-level=INFO',
|
|
|
+ '--myext.magic.numbers'],
|
|
|
+ prefix='step4',
|
|
|
+ check_stderr=[(0, -1)])
|
|
|
+ self.assertExec(runner.run())
|
|
|
+ runner = tests.common.ToolRunner('view',
|
|
|
+ ['--log-level=INFO'],
|
|
|
+ prefix='step4',
|
|
|
+ check_stderr=[(0, -1)])
|
|
|
+ self.assertExec(runner.run())
|
|
|
+
|
|
|
+ os.environ['METRIXPLUSPLUS_PATH'] = os.path.join(os.path.dirname(os.path.abspath(__file__)),
|
|
|
+ 'test_api_tutorial', 'ext', 'step5')
|
|
|
+ runner = tests.common.ToolRunner('collect',
|
|
|
+ ['--log-level=INFO',
|
|
|
+ '--myext.magic.numbers'],
|
|
|
+ prefix='step5',
|
|
|
+ check_stderr=[(0, -1)])
|
|
|
+ self.assertExec(runner.run())
|
|
|
+ runner = tests.common.ToolRunner('view',
|
|
|
+ ['--log-level=INFO'],
|
|
|
+ prefix='step5',
|
|
|
+ check_stderr=[(0, -1)])
|
|
|
+ self.assertExec(runner.run())
|
|
|
+
|
|
|
+
|
|
|
+ if METRIXPLUSPLUS_PATH != None:
|
|
|
+ os.environ['METRIXPLUSPLUS_PATH'] = METRIXPLUSPLUS_PATH
|
|
|
+
|
|
|
+if __name__ == '__main__':
|
|
|
+ unittest.main()
|
|
|
+
|