AttributeError: 'builtin_function_or_method' object has no attribute 'sleep' after adding power draw support

RESOLVED FIXED

Status

Firefox OS
Gaia::UI Tests
P1
major
RESOLVED FIXED
4 years ago
4 years ago

People

(Reporter: davehunt, Assigned: huseby)

Tracking

({perf})

unspecified
ARM
Gonk (Firefox OS)

Firefox Tracking Flags

(firefox28 fixed, b2g-v1.2 fixed)

Details

(Whiteboard: [c=power p= s= u=])

Attachments

(1 attachment)

46 bytes, text/x-github-pull-request
davehunt
: review+
Details | Review | Splinter Review
(Reporter)

Description

4 years ago
It appears that the Yoctopuce library used to gather power draw data has cause an import issue with the standard Python module 'time'.

This can be replicated when the risks have been acknowledged but the warning is not skipped. This would usually delay for 30 seconds, but instead now fails.

$ GAIATEST_ACKNOWLEDGED_RISKS=true gaiatest --address=localhost:2828 gaiatest/tests/functional/browser/test_browser_navigation.py
...
The test run will continue in 30 seconds.
Traceback (most recent call last):
  File "/Users/dhunt/.virtualenvs/gaiatest/bin/gaiatest", line 9, in <module>
    load_entry_point('gaiatest==0.19', 'console_scripts', 'gaiatest')()
  File "/Users/dhunt/workspace/gaia/tests/python/gaia-ui-tests/gaiatest/runtests.py", line 391, in main
    cli(runner_class=GaiaTestRunner, parser_class=GaiaTestOptions)
  File "/Users/dhunt/workspace/mozilla/mozilla-central/testing/marionette/client/marionette/runtests.py", line 916, in cli
    runner = startTestRunner(runner_class, options, tests)
  File "/Users/dhunt/workspace/mozilla/mozilla-central/testing/marionette/client/marionette/runtests.py", line 907, in startTestRunner
    runner = runner_class(**vars(options))
  File "/Users/dhunt/workspace/gaia/tests/python/gaia-ui-tests/gaiatest/runtests.py", line 240, in __init__
    time.sleep(delay)

I believe this is due to the import in yocto_datalogger.py here: https://github.com/yoctopuce/yoctolib_python/blob/deee5e4413490dda06edf10c9c5be6e785344423/Sources/yocto_datalogger.py#L42

I think we can avoid this by only importing the items from the Yoctopuce modules that we need. Currently we have:

from yoctopuce.yocto_api import *
from yoctopuce.yocto_current import *
from yoctopuce.yocto_datalogger import *

We should try replacing this with:

from yoctopuce.yocto_api import YAPI
from yoctopuce.yocto_current import YCurrent
from yoctopuce.yocto_datalogger import YDataLogger

I do not have the necessary hardware to test that this works with the power draw testing.
(Reporter)

Comment 1

4 years ago
:huseby could you have a look at this please?
(Assignee)

Comment 2

4 years ago
yup, I'll take a look
(Assignee)

Updated

4 years ago
Keywords: perf
Priority: -- → P1
Whiteboard: [c=power p= s= u=]

Updated

4 years ago
Status: NEW → ASSIGNED
(Assignee)

Comment 3

4 years ago
Created attachment 8339577 [details] [review]
pull request
Attachment #8339577 - Flags: review?(dave.hunt)
(Reporter)

Updated

4 years ago
Status: ASSIGNED → RESOLVED
Last Resolved: 4 years ago
status-b2g-v1.2: --- → fixed
status-firefox28: --- → fixed
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.