Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- root@5026b15ac8bb:~/repos/functest# functest testcase run barometer -n
- 2017-02-15 19:11:16,710 - run_tests - INFO - ============================================
- 2017-02-15 19:11:16,710 - run_tests - INFO - Running test case 'barometer'...
- 2017-02-15 19:11:16,711 - run_tests - INFO - ============================================
- 2017-02-15 19:11:16,794 - run_tests - ERROR - Cannot import module functest.opnfv_tests.features.barometer
- Traceback (most recent call last):
- File "/home/opnfv/repos/functest/functest/ci/run_tests.py", line 157, in run_test
- module = importlib.import_module(run_dict['module'])
- File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
- __import__(name)
- File "/usr/local/lib/python2.7/dist-packages/functest/opnfv_tests/features/barometer.py", line 16, in <module>
- from barometer.functest import collectd
- ImportError: No module named functest
- 2017-02-15 19:11:16,795 - run_tests - INFO - Test execution time: 00:00
- 2017-02-15 19:11:16,795 - run_tests - ERROR - The test case 'barometer' failed.
- 2017-02-15 19:11:16,795 - run_tests - INFO - Execution exit value: Result.EX_ERROR
- 2017-02-15 19:11:16,840 - functest_utils - ERROR - The command 'python /home/opnfv/repos/functest/functest/ci/run_tests.py -n -t barometer' failed.
- root@5026b15ac8bb:~/repos/functest# python /usr/local/lib/python2.7/dist-packages/functest/opnfv_tests/features/barometer.py
- Traceback (most recent call last):
- File "/usr/local/lib/python2.7/dist-packages/functest/opnfv_tests/features/barometer.py", line 16, in <module>
- from barometer.functest import collectd
- File "/usr/local/lib/python2.7/dist-packages/functest/opnfv_tests/features/barometer.py", line 16, in <module>
- from barometer.functest import collectd
- ImportError: No module named functest
- #### So, it complains about importing the barometer module.. Let's try manually on the python prompt.
- root@5026b15ac8bb:~/repos/functest# python
- Python 2.7.6 (default, Oct 26 2016, 20:30:19)
- [GCC 4.8.4] on linux2
- Type "help", "copyright", "credits" or "license" for more information.
- >>> from barometer.functest import collectd <=================== this works
- >>> dir(collectd)
- ['__builtins__', '__doc__', '__file__', '__name__', '__package__', 'main', 'sys']
- #### content of the package:
- root@5026b15ac8bb:~/repos/functest# cat /usr/local/lib/python2.7/dist-packages/functest/opnfv_tests/features/barometer.py
- #!/usr/bin/python
- #
- # Licensed under the Apache License, Version 2.0 (the "License");
- # you may not use this file except in compliance with the License.
- # You may obtain a copy of the License at
- #
- # http://www.apache.org/licenses/LICENSE-2.0
- import time
- from functest.core import testcase_base
- import functest.utils.functest_logger as ft_logger
- import functest.utils.functest_utils as functest_utils
- from barometer.functest import collectd <=================== this doesn't work work
- class BarometerCollectd(testcase_base.TestcaseBase):
- '''
- Class for executing barometercollectd testcase.
- '''
- def __init__(self):
- super(BarometerCollectd, self).__init__()
- self.project_name = "barometer"
- self.case_name = "barometercollectd"
- def run(self, **kwargs):
- logger = ft_logger.Logger("BarometerCollectd").getLogger()
- self.start_time = time.time()
- ret = collectd.main()
- self.stop_time = time.time()
- if ret == 0:
- self.criteria = 'PASS'
- result = testcase_base.TestcaseBase.EX_OK
- else:
- self.criteria = 'FAIL'
- result = testcase_base.TestcaseBase.EX_TESTCASE_FAILED
- functest_utils.logger_test_results(
- self.project_name, self.case_name, self.criteria, self.details)
- return result
Advertisement
Add Comment
Please, Sign In to add comment