Closed Bug 1888570 Opened 6 months ago Closed 3 months ago

Running browser chrome tests locally with python 3.12 fails

Categories

(Testing :: Mochitest, defect, P2)

defect

Tracking

(firefox129 fixed)

RESOLVED FIXED
129 Branch
Tracking Status
firefox129 --- fixed

People

(Reporter: bytesized, Assigned: ahochheiden)

References

(Blocks 3 open bugs)

Details

Attachments

(2 files)

When I try to run browser chrome mochitests locally on macOS, I get an error. It seems to be consistent no matter which browser chrome test I attempt to run:

> ./mach test browser/components/urlbar/tests/browser-tips/suppress-tips/browser_suppressTips.js 
Error running mach:

    mach test browser/components/urlbar/tests/browser-tips/suppress-tips/browser_suppressTips.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 can invoke ``./mach busted`` to check if this issue is already on file. If it
isn't, please use ``./mach busted file test`` to report it. If ``./mach busted`` is
misbehaving, you can also inspect the dependencies of bug 1543241.

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

The details of the failure are as follows:

ModuleNotFoundError: No module named 'distutils'

  File "/Users/tester/mozilla-unified/testing/mach_commands.py", line 454, in test
    res = command_context._mach_context.commands.dispatch(
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/tester/mozilla-unified/python/mach/mach/registrar.py", line 182, in dispatch
    if handler.parser:
       ^^^^^^^^^^^^^^
  File "/Users/tester/mozilla-unified/python/mach/mach/decorators.py", line 105, in parser
    self._parser = self._parser()
                   ^^^^^^^^^^^^^^
  File "/Users/tester/mozilla-unified/testing/mochitest/mach_commands.py", line 193, in setup_argument_parser
    load_source("mochitest", path)
  File "/Users/tester/mozilla-unified/testing/mozbase/mozfile/mozfile/mozfile.py", line 645, in load_source
    loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 995, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/Users/tester/mozilla-unified/obj-clean/_tests/testing/mochitest/runtests.py", line 37, in <module>
    from distutils import spawn

Sentry event ID: 2f9e8baae3054258bb5f0b595625b0a0

I tried this on a clean checkout of mozilla-central with a mozconfig with only this line uncommented:

mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/obj-clean
Blocks: 1743785
Component: General → Mochitest
OS: macOS → Unspecified
Product: Firefox Build System → Testing
Summary: Running browser chrome tests locally on macOS fails → Running browser chrome tests locally with python 3.12 fails

I doubt macOS ships with python 3.12 itself. Try uninstalling python 3.12 and use the python3 that comes with the command line tools.

Ran into this after a brew upgrade. brew unlink python@3.12 fixed the issue.

If I try to remove it, I get a warning that uninstalling it will break watchman. If I uninstall it and watchman and then rerun ./mach bootstrap it just installs python 3.12 again, presumably in order to install watchman.

(In reply to Paul Zühlcke [:pbz] from comment #3)

Ran into this after a brew upgrade. brew unlink python@3.12 fixed the issue.

This did seem to work for me.

The severity field is not set for this bug.
:jmaher, could you have a look please?

For more information, please visit BugBot documentation.

Flags: needinfo?(jmaher)

we will end up needing to support newer versions of python both from mach and in CI. For now this has a workaround.

Severity: -- → S3
Flags: needinfo?(jmaher)
Priority: -- → P2
Assignee: nobody → ahochheiden
Status: NEW → ASSIGNED
Attachment #9403912 - Attachment description: Bug 1888570 - Replace `distutils.util.strtobool` with `mach.util.strtobool` within `mochitest` r?jmaher → Bug 1888570 - Replace `distutils.util.strtobool` with a custom `strtobool` within `mochitest` r?jmaher
Duplicate of this bug: 1899940
Pushed by ahochheiden@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/dee593604635 Replace all usages of `distutils.spawn.find_executable` with `shutil.which` within `mochitest` r=jmaher https://hg.mozilla.org/integration/autoland/rev/689cadd510e1 Replace `distutils.util.strtobool` with a custom `strtobool` within `mochitest` r=jmaher

Thanks!

Flags: needinfo?(ahochheiden)
Pushed by ahochheiden@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/a7b92246bd4d Replace all usages of `distutils.spawn.find_executable` with `shutil.which` within `mochitest` r=jmaher https://hg.mozilla.org/integration/autoland/rev/5621ba683661 Replace `distutils.util.strtobool` with a custom `strtobool` within `mochitest` r=jmaher
Status: ASSIGNED → RESOLVED
Closed: 3 months ago
Resolution: --- → FIXED
Target Milestone: --- → 129 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: