summaryrefslogtreecommitdiff
path: root/rtemstoolkit/check.py
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2018-11-23 15:02:52 +1100
committerChris Johns <chrisj@rtems.org>2018-11-23 15:02:52 +1100
commit7e5cdeaabeaa95b8533af626b99a43c93e5ecf6f (patch)
tree2ecd175bb744024567e6823353cd50b795604b35 /rtemstoolkit/check.py
parent6fa09650b8a936782aa9352e5e23001360317b9d (diff)
rtemstoolkit: Add unit testing for the python modules
- Add support to run the unit tests for the rtemstoolkit python modules from waf. Enter './waf test' for the tests to be run on python2 and python3. - Update the importing of rtemstoolkit modules to the standard method which works on python2 and python3. - Update the README.
Diffstat (limited to 'rtemstoolkit/check.py')
-rw-r--r--rtemstoolkit/check.py32
1 files changed, 10 insertions, 22 deletions
diff --git a/rtemstoolkit/check.py b/rtemstoolkit/check.py
index c6549bf..8d4a35c 100644
--- a/rtemstoolkit/check.py
+++ b/rtemstoolkit/check.py
@@ -36,24 +36,12 @@ from __future__ import print_function
import os
-#
-# Support to handle use in a package and as a unit test.
-# If there is a better way to let us know.
-#
-try:
- from . import error
- from . import execute
- from . import log
- from . import options
- from . import path
- from . import version
-except (ValueError, SystemError):
- import error
- import execute
- import log
- import options
- import path
- import version
+from rtemstoolkit import error
+from rtemstoolkit import execute
+from rtemstoolkit import log
+from rtemstoolkit import options
+from rtemstoolkit import path
+from rtemstoolkit import version
def _check_none(_opts, macro, value, constraint):
return True
@@ -163,12 +151,12 @@ def check_dir(label, path):
return _check_dir(None, label, path, 'required', True)
-def run():
+def run(args):
import sys
try:
- _opts = options.command_line(argv = sys.argv)
+ _opts = options.command_line(argv = args)
options.load(_opts)
- log.notice('RTEMS Source Builder - Check, v%s' % (version.string()))
+ log.notice('RTEMS Toolkit - Check, v%s' % (version.string()))
if host_setup(_opts):
print('Environment is ok')
else:
@@ -188,4 +176,4 @@ def run():
if __name__ == '__main__':
- run()
+ run(['tester'])