jolausa

Untitled

Feb 15th, 2017
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.83 KB | None | 0 0
  1. root@5026b15ac8bb:~/repos/functest# functest testcase run barometer -n
  2.  
  3. 2017-02-15 19:11:16,710 - run_tests - INFO - ============================================
  4. 2017-02-15 19:11:16,710 - run_tests - INFO - Running test case 'barometer'...
  5. 2017-02-15 19:11:16,711 - run_tests - INFO - ============================================
  6. 2017-02-15 19:11:16,794 - run_tests - ERROR - Cannot import module functest.opnfv_tests.features.barometer
  7. Traceback (most recent call last):
  8. File "/home/opnfv/repos/functest/functest/ci/run_tests.py", line 157, in run_test
  9. module = importlib.import_module(run_dict['module'])
  10. File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
  11. __import__(name)
  12. File "/usr/local/lib/python2.7/dist-packages/functest/opnfv_tests/features/barometer.py", line 16, in <module>
  13. from barometer.functest import collectd
  14. ImportError: No module named functest
  15. 2017-02-15 19:11:16,795 - run_tests - INFO - Test execution time: 00:00
  16. 2017-02-15 19:11:16,795 - run_tests - ERROR - The test case 'barometer' failed.
  17. 2017-02-15 19:11:16,795 - run_tests - INFO - Execution exit value: Result.EX_ERROR
  18. 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.
  19.  
  20.  
  21.  
  22.  
  23.  
  24. root@5026b15ac8bb:~/repos/functest# python /usr/local/lib/python2.7/dist-packages/functest/opnfv_tests/features/barometer.py
  25. Traceback (most recent call last):
  26. File "/usr/local/lib/python2.7/dist-packages/functest/opnfv_tests/features/barometer.py", line 16, in <module>
  27. from barometer.functest import collectd
  28. File "/usr/local/lib/python2.7/dist-packages/functest/opnfv_tests/features/barometer.py", line 16, in <module>
  29. from barometer.functest import collectd
  30. ImportError: No module named functest
  31.  
  32.  
  33.  
  34. #### So, it complains about importing the barometer module.. Let's try manually on the python prompt.
  35.  
  36.  
  37. root@5026b15ac8bb:~/repos/functest# python
  38. Python 2.7.6 (default, Oct 26 2016, 20:30:19)
  39. [GCC 4.8.4] on linux2
  40. Type "help", "copyright", "credits" or "license" for more information.
  41. >>> from barometer.functest import collectd <=================== this works
  42. >>> dir(collectd)
  43. ['__builtins__', '__doc__', '__file__', '__name__', '__package__', 'main', 'sys']
  44.  
  45.  
  46.  
  47.  
  48.  
  49. #### content of the package:
  50.  
  51.  
  52.  
  53. root@5026b15ac8bb:~/repos/functest# cat /usr/local/lib/python2.7/dist-packages/functest/opnfv_tests/features/barometer.py
  54. #!/usr/bin/python
  55. #
  56. # Licensed under the Apache License, Version 2.0 (the "License");
  57. # you may not use this file except in compliance with the License.
  58. # You may obtain a copy of the License at
  59. #
  60. # http://www.apache.org/licenses/LICENSE-2.0
  61.  
  62.  
  63. import time
  64.  
  65. from functest.core import testcase_base
  66. import functest.utils.functest_logger as ft_logger
  67. import functest.utils.functest_utils as functest_utils
  68.  
  69. from barometer.functest import collectd <=================== this doesn't work work
  70.  
  71.  
  72. class BarometerCollectd(testcase_base.TestcaseBase):
  73. '''
  74. Class for executing barometercollectd testcase.
  75. '''
  76.  
  77. def __init__(self):
  78. super(BarometerCollectd, self).__init__()
  79. self.project_name = "barometer"
  80. self.case_name = "barometercollectd"
  81.  
  82. def run(self, **kwargs):
  83. logger = ft_logger.Logger("BarometerCollectd").getLogger()
  84.  
  85. self.start_time = time.time()
  86.  
  87. ret = collectd.main()
  88.  
  89. self.stop_time = time.time()
  90.  
  91. if ret == 0:
  92. self.criteria = 'PASS'
  93. result = testcase_base.TestcaseBase.EX_OK
  94. else:
  95. self.criteria = 'FAIL'
  96. result = testcase_base.TestcaseBase.EX_TESTCASE_FAILED
  97.  
  98. functest_utils.logger_test_results(
  99. self.project_name, self.case_name, self.criteria, self.details)
  100.  
  101. return result
Advertisement
Add Comment
Please, Sign In to add comment