123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- #
- # 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_metric_plugin_api(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']
-
- for step in range(8):
- opts = ['--log-level=INFO']
- if step > 1:
- opts.append('--myext.magic.numbers')
-
- os.environ['METRIXPLUSPLUS_PATH'] = os.path.join(os.path.dirname(os.path.abspath(__file__)),
- 'test_api_tutorial', 'ext', 'step' + str(step))
- runner = tests.common.ToolRunner('collect',
- opts,
- prefix='step' + str(step),
- check_stderr=[(0, -1)])
- self.assertExec(runner.run())
-
- if step < 4:
- continue
-
- runner = tests.common.ToolRunner('view',
- ['--log-level=INFO'],
- prefix='step' + str(step),
- check_stderr=[(0, -1)])
- self.assertExec(runner.run())
- if METRIXPLUSPLUS_PATH != None:
- os.environ['METRIXPLUSPLUS_PATH'] = METRIXPLUSPLUS_PATH
- if __name__ == '__main__':
- unittest.main()
-
|