Import Error: No module named application_cache when executing ./mach marionette-webapi in OS X

RESOLVED FIXED in Firefox 43

Status

RESOLVED FIXED
3 years ago
3 years ago

People

(Reporter: bevis, Unassigned)

Tracking

unspecified
mozilla43
Points:
---

Firefox Tracking Flags

(firefox43 fixed)

Details

MozReview Requests

Submitter Diff Changes Open Issues Last Updated
Loading...
Error loading review requests:

Attachments

(1 attachment, 1 obsolete attachment)

It seems that there is ambiguity in the package 'marionette' and the module of 'marionette.py' when running runtests.py in marionette.

I'll upload a patch works locally for reference.

ImportError: No module named application_cache

  File "/Users/bevis/Projects/Builds/emulator-x86-kk/../gecko/src/testing/marionette/mach_commands.py", line 110, in run_marionette_webapi
    topsrcdir=self.topsrcdir, **kwargs)
  File "/Users/bevis/Projects/Builds/emulator-x86-kk/../gecko/src/testing/marionette/mach_commands.py", line 40, in run_marionette
    from marionette.runtests import (
  File "/Users/bevis/Projects/Builds/gecko/src/build/mach_bootstrap.py", line 356, in __call__
    module = self._original_import(name, globals, locals, fromlist, level)
  File "/Users/bevis/Projects/Builds/emulator-x86-kk/../gecko/src/testing/marionette/client/marionette/runtests.py", line 7, in <module>
    from marionette import __version__
  File "/Users/bevis/Projects/Builds/gecko/src/build/mach_bootstrap.py", line 356, in __call__
    module = self._original_import(name, globals, locals, fromlist, level)
  File "/Users/bevis/Projects/Builds/emulator-kk/../gecko/src/testing/marionette/client/marionette/marionette.py", line 16, in <module>
  File "/Users/bevis/Projects/Builds/gecko/src/build/mach_bootstrap.py", line 356, in __call__
    module = self._original_import(name, globals, locals, fromlist, level)
(Reporter)

Comment 1

3 years ago
Created attachment 8655827 [details] [diff] [review]
Patch: Remove the ambiguity of marionette module and marionette package in runtests.py.
(Reporter)

Updated

3 years ago
Assignee: nobody → btseng
(Reporter)

Comment 3

3 years ago
Patch not working in try server. :(

01:52:07     INFO -  Traceback (most recent call last):
01:52:07     INFO -    File "C:\slave\test\build\tests\marionette\marionette\runtests.py", line 7, in <module>
01:52:07     INFO -      from __init__ import __version__
01:52:07     INFO -    File "C:\slave\test\build\tests\marionette\marionette\__init__.py", line 8, in <module>
01:52:07     INFO -      from .marionette_test import MarionetteTestCase, MarionetteJSTestCase, CommonTestCase, expectedFailure, skip, SkipTest
01:52:07     INFO -  ValueError: Attempted relative import in non-package
(Reporter)

Comment 5

3 years ago
Still have no clue why the marionette.py in marionette_driver will be searched earlier than marionette client package in runtests.py even the search path of '/src/testing/marionette/client' is in prior to '/src/testing/marionette/driver' in sys.path.
(Reporter)

Comment 6

3 years ago
(In reply to Bevis Tseng[:bevistseng][:btseng] from comment #4)
> https://treeherder.mozilla.org/#/jobs?repo=try&revision=580ff9b520b2

2nd trial by replacing "from __init__ import __version__" to "from . import __version__".
(Reporter)

Comment 7

3 years ago
(In reply to Bevis Tseng[:bevistseng][:btseng] from comment #6)
> (In reply to Bevis Tseng[:bevistseng][:btseng] from comment #4)
> > https://treeherder.mozilla.org/#/jobs?repo=try&revision=580ff9b520b2
> 
> 2nd trial by replacing "from __init__ import __version__" to "from . import
> __version__".

Still not working on tryserver. :(

Hi David,

Would you mind to give some hint about this problem?

Thanks!
Flags: needinfo?(dburns)
(Reporter)

Comment 8

3 years ago
Note: Something is interesting:
1. This symptom happens even if I rebuild emulator by removing the objdir-gecko.
2. However, this symptom is not reproducible if I create a new emulator from scratch. 
(git clone B2G, ./config.sh emulator-x86-kk, ./build.sh and run the mach marionette-webapi for test.)
(Reporter)

Comment 9

3 years ago
(In reply to Bevis Tseng[:bevistseng][:btseng] from comment #8)
> Note: Something is interesting:
> 1. This symptom happens even if I rebuild emulator by removing the
> objdir-gecko.
> 2. However, this symptom is not reproducible if I create a new emulator from
> scratch. 
> (git clone B2G, ./config.sh emulator-x86-kk, ./build.sh and run the mach
> marionette-webapi for test.)

Sorry, please ignore this comment.
The symptom still exists even if I setup from scratch.
The build environment is in OS X 10.10.
I don't think this code is needed anymore so have done a push to try

https://treeherder.mozilla.org/#/jobs?repo=try&revision=d5da608ca62b

which has it removed
Flags: needinfo?(dburns)
(In reply to David Burns :automatedtester from comment #11)
> I don't think this code is needed anymore so have done a push to try
> 
> https://treeherder.mozilla.org/#/jobs?repo=try&revision=d5da608ca62b
> 
> which has it removed

This can only be reproduced in OSX environment locally as mentioned in comment 0 even the search path correctly set because I saw '/src/testing/marionette/client' is in prior to '/src/testing/marionette/driver' in |sys.path| before |from marionette import __version__| in "marionette/runtests.py" is executed.

The |./mach marionette-webapi| works well in both Ubuntu and treeherder without applying the patch in comment 1.

We have people developing B2G on Mac. This blocks us to test the implementation locally. :(
Summary: Import Error: No module named application_cache when executing ./mach marionette-webapi → Import Error: No module named application_cache when executing ./mach marionette-webapi in OS X
Took too much time on this.

Leave the workaround here then people who meet the same problem in OS X could pick up this patch locally to run the test.
Assignee: btseng → nobody
Created attachment 8658151 [details]
MozReview Request: Bug 1200973 - Remove unneeded app cache code from Marionette; r?jgriffin

Bug 1200973 - Remove unneeded app cache code from Marionette; r?jgriffin
Attachment #8658151 - Flags: review?(jgriffin)
The failing WPT tests are not my problem apparently :)

13:05 AutomatedTester: treeherder has it as red
13:05 AutomatedTester: treeherder says there is no failure summary
13:05 jgraham: Oh, right
13:05 jgraham: wpt on try is broken in two different ways at the moment :|
13:05 jgraham: 1) wpt-e10s landed without a seperate job symbol on treeherder
13:06 jgraham: 2) wpt-e10s landed with a broken buildbot config for several cases
13:06 jgraham: Both issues are fixed in the source, both are waiting for a deployment to production
13:06 AutomatedTester: should I care that they are red ?
13:06 jgraham: No
13:06 AutomatedTester: thats me happy :)
Attachment #8658151 - Flags: review?(jgriffin) → review+
Comment on attachment 8658151 [details]
MozReview Request: Bug 1200973 - Remove unneeded app cache code from Marionette; r?jgriffin

https://reviewboard.mozilla.org/r/18487/#review16647
https://hg.mozilla.org/mozilla-central/rev/c558ee35c092
Status: NEW → RESOLVED
Last Resolved: 3 years ago
status-firefox43: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla43
Just found the root cause of the symptom in comment 0.
If I clear all the .pyc files in gecko/testing, then I can launch the marionette test cases normally. :)
$find . -type f -name "*.pyc" -exec rm -f {} \;
(Reporter)

Updated

3 years ago
Attachment #8655827 - Attachment is obsolete: true
(In reply to Bevis Tseng[:bevistseng][:btseng] from comment #20)
> Just found the root cause of the symptom in comment 0.
> If I clear all the .pyc files in gecko/testing, then I can launch the
> marionette test cases normally. :)
> $find . -type f -name "*.pyc" -exec rm -f {} \;

I suggest setting the output variable PYTHONDONTWRITEBYTECODE for development environments.
(In reply to Andreas Tolfsen (:ato) from comment #21)
> (In reply to Bevis Tseng[:bevistseng][:btseng] from comment #20)
> > Just found the root cause of the symptom in comment 0.
> > If I clear all the .pyc files in gecko/testing, then I can launch the
> > marionette test cases normally. :)
> > $find . -type f -name "*.pyc" -exec rm -f {} \;
> 
> I suggest setting the output variable PYTHONDONTWRITEBYTECODE for
> development environments.

Thanks, I'll put this in my config file. (y)
You need to log in before you can comment on or make changes to this bug.