Closed Bug 983821 Opened 6 years ago Closed 4 years ago

'marionette' cli entrypoint doesn't have access to proper packages

Categories

(Testing :: Marionette, defect)

defect
Not set

Tracking

(firefox42 fixed)

RESOLVED FIXED
mozilla42
Tracking Status
firefox42 --- fixed

People

(Reporter: mdas, Assigned: parkouss)

Details

(Keywords: pi-marionette-runner, Whiteboard: [runner])

Attachments

(1 file)

if you install the marionette client package and do

marionette --address=localhost:2828 tests/unit/test_log.py

in <mozilla-central>/testing/marionette/client/marionette/ , then you'll get a stacktrace with:

    from marionette_test import MarionetteTestCase
ImportError: No module named marionette_test

so something's wrong in our packaging/entrypoint.
Whiteboard: [runner]
I can not reproduce this issue, either by installing from pypi or directly from the tree.

I tried:

pip install marionette_client
pip install -e . (in TREE/testing/marionette/client)

each time in a fresh virtualenv, with the command "marionette tests/unit/test_log.py --binary `which firefox`" and this run fine.

But I saw that there are some import in client that are not "absolute" - ie, there is "from marionette_test".

I think that these imports inside the package should be replaced by either "from marionette.marionette_test", or "from .marionette_test" to avoid possible module name conflict.

https://dxr.mozilla.org/mozilla-central/search?q=marionette_test&redirect=true

:mdas, does that sound like fixing this bug if I do these changes ?
Flags: needinfo?(malini)
Whoa, bugmail! Haven't had this in a while :)

I'm now working for a closed source company, and unfortunately, I don't have clearance to work on Marionette yet, so I can't really help out.

I think dburns should be able to advise here.
Flags: needinfo?(malini) → needinfo?(dburns)
yea, doing that will be fixing this bug. Thanks!
Flags: needinfo?(dburns)
Bug 983821 - 'marionette' cli entrypoint doesn't have access to proper packages. r?dburns
Attachment #8631142 - Flags: review?(dburns)
Assignee: nobody → j.parkouss
Status: NEW → ASSIGNED
Comment on attachment 8631142 [details]
MozReview Request: Bug 983821 - 'marionette' cli entrypoint doesn't have access to proper packages. r?dburns

https://reviewboard.mozilla.org/r/12845/#review11609

Ship It!
Attachment #8631142 - Flags: review?(dburns) → review+
Hmm, all red, because of "Attempted relative import in non-package". This is because test harnesses uses the runtests.py script (inside the marionette_client package), hence this pass locally because I used the "marionette" executable entry point installed inside the virtualenv.

Usually, I find that it is not a good habit to call some scripts inside a package directy from the interpreter, because of these kind of errors, and also because it is then possible to have this executed file imported twice, which is then a lot confusing.

Anyway I fixed the relative imports inside runtests.py to be absolute (using marionette instead of .) - I think that's ok for you David. This should do the trick, and another bug could be raised in case you want to get rid of the runtests.py call made by the harnesses.

new push to try: https://treeherder.mozilla.org/#/jobs?repo=try&revision=6d973ba7c2ff
Yeah, all green this time. David, is the new patch ok for you, and could I land that ?
Flags: needinfo?(dburns)
land it!
Flags: needinfo?(dburns)
https://hg.mozilla.org/mozilla-central/rev/b1ff86fd9890
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla42
You need to log in before you can comment on or make changes to this bug.