Commit d6bceadd authored by Grégory Wisniewski's avatar Grégory Wisniewski

Add command selectors to tests runner.

Allow override the defaults to run unit, functional or both test suites.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@1673 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 5af243ef
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
import optparse
import unittest import unittest
import tempfile import tempfile
import logging import logging
...@@ -318,9 +319,19 @@ class NeoTestRunner(unittest.TestResult): ...@@ -318,9 +319,19 @@ class NeoTestRunner(unittest.TestResult):
if __name__ == "__main__": if __name__ == "__main__":
# handle command line options
parser = optparse.OptionParser()
parser.add_option('-f', '--functional', action='store_true')
parser.add_option('-u', '--unit', action='store_true')
(options, args) = parser.parse_args()
if options.functional or options.unit:
# override defaults
FUNCTIONAL_TESTS = options.functional
UNIT_TESTS = options.unit
if not UNIT_TESTS and not FUNCTIONAL_TESTS: if not UNIT_TESTS and not FUNCTIONAL_TESTS:
raise RuntimeError('Nothing to run') raise RuntimeError('Nothing to run')
# run and build the report # run and build the report
runner = NeoTestRunner() runner = NeoTestRunner()
if UNIT_TESTS: if UNIT_TESTS:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment