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

RESOLVED FIXED in Firefox 53

Status

--
blocker
RESOLVED FIXED
2 years ago
2 years ago

People

(Reporter: standard8, Assigned: ahal)

Tracking

Version 3
mozilla53
Points:
---

Firefox Tracking Flags

(firefox53 fixed)

Details

Attachments

(1 attachment)

(Reporter)

Description

2 years ago
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)
I got the same problem.
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 hidden (mozreview-request)

Comment 4

2 years ago
mozreview-review
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+

Comment 5

2 years ago
Pushed by ahalberstadt@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/a354fb29db49
Fix mochitest import error when running via mach, r=jmaher
(Assignee)

Comment 6

2 years ago
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)

Comment 7

2 years ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/a354fb29db49
Status: ASSIGNED → RESOLVED
Last Resolved: 2 years ago
status-firefox53: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla53
You need to log in before you can comment on or make changes to this bug.