Closed Bug 1328549 Opened 7 years ago Closed 7 years ago

Can't run mochitests due to "ImportError: No module named mochitest_options"

Categories

(Testing :: General, defect)

Version 3
defect
Not set
blocker

Tracking

(firefox53 fixed)

RESOLVED FIXED
mozilla53
Tracking Status
firefox53 --- fixed

People

(Reporter: standard8, Assigned: ahal)

References

Details

Attachments

(1 file)

As of bug 1312739 landing, I'm no longer able to run mochitests locally, here's what I get:

$ ./mach mochitest
Error running mach:

    ['mochitest']

The error occurred in code that was called by the mach command. This is either
a bug in the called code itself or in the way that mach is calling it.

You should consider filing a bug for this issue.

If filing a bug, please include the full output of mach, including this error
message.

The details of the failure are as follows:

ImportError: No module named mochitest_options

  File "/Users/mark/dev/gecko/testing/mochitest/mach_commands.py", line 283, in run_mochitest_general
    from mochitest.mochitest_options import ALL_FLAVORS
  File "/Users/mark/dev/gecko/build/mach_bootstrap.py", line 373, in __call__
    module = self._original_import(name, globals, locals, fromlist, level)


$ ./mach test browser/base/content/test/urlbar/browser_locationBarCommand.js 
Error running mach:

    ['test', 'browser/base/content/test/urlbar/browser_locationBarCommand.js']

The error occurred in code that was called by the mach command. This is either
a bug in the called code itself or in the way that mach is calling it.

You should consider filing a bug for this issue.

If filing a bug, please include the full output of mach, including this error
message.

The details of the failure are as follows:

ImportError: No module named mochitest_options

  File "/Users/mark/dev/gecko/testing/mach_commands.py", line 333, in test
    test_objects=tests, **kwargs)
  File "/Users/mark/dev/gecko/python/mach/mach/registrar.py", line 123, in dispatch
    return self._run_command_handler(handler, context=context, **kwargs)
  File "/Users/mark/dev/gecko/python/mach/mach/registrar.py", line 90, in _run_command_handler
    result = fn(**kwargs)
  File "/Users/mark/dev/gecko/testing/mochitest/mach_commands.py", line 283, in run_mochitest_general
    from mochitest.mochitest_options import ALL_FLAVORS
  File "/Users/mark/dev/gecko/build/mach_bootstrap.py", line 373, in __call__
    module = self._original_import(name, globals, locals, fromlist, level)
Flags: needinfo?(ahalberstadt)
Same problem here. Changing the import at
  http://searchfox.org/mozilla-central/source/testing/mochitest/mach_commands.py#283
from
  from mochitest.mochitest_options import ALL_FLAVORS
to
  from mochitest_options import ALL_FLAVORS
solved it for me (running mach mochitest on macOS Sierra)
Comment on attachment 8823654 [details]
Bug 1328549 - Fix mochitest import error when running via mach,

https://reviewboard.mozilla.org/r/102218/#review102516

lets land this!
Attachment #8823654 - Flags: review?(jmaher) → review+
Pushed by ahalberstadt@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/a354fb29db49
Fix mochitest import error when running via mach, r=jmaher
This was failing because we were "faking" the mochitest module here:
https://dxr.mozilla.org/mozilla-central/source/testing/mochitest/mach_commands.py#282

This was overwriting the "real" mochitest module under testing/mochitest.
Assignee: nobody → ahalberstadt
Status: NEW → ASSIGNED
Flags: needinfo?(ahalberstadt)
https://hg.mozilla.org/mozilla-central/rev/a354fb29db49
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla53
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: