Closed Bug 1438250 Opened 6 years ago Closed 6 years ago

Make mozunit pip installable

Categories

(Firefox Build System :: Mach Core, enhancement)

enhancement
Not set
normal

Tracking

(firefox61 fixed)

RESOLVED FIXED
mozilla61
Tracking Status
firefox61 --- fixed

People

(Reporter: davehunt, Assigned: davehunt)

References

Details

Attachments

(1 file, 1 obsolete file)

mozunit is currently not installable via pip, which means that it can't be listed as a dependency in a Pipfile. Once bug 1313547 is resolved, I would like to install mozunit via pipenv to help solve bug 1388013. I've experimented locally by simply creating /config/mozunit/mozunit/mozunit.py (and associated setup.py, __init__py, etc) with some success.
ahal: Is there any reason we shouldn't do this? Would it perhaps also make sense to move this to /python?
Flags: needinfo?(ahalberstadt)
Blocks: 1388013
Tbh, I think I'd prefer if mozunit just didn't exist.

Right now we do `subprocess.call(['python', 'path/to/test']). Then in the test's __main__ we call mozunit.main(). Then in mozunit.main() we call pytest.main().

I think this setup is only for legacy reasons, and I don't see why we couldn't just run `subprocess.call(['pytest', 'path/to/test'])` directly from python/mach_commands.py in the first place. Though I think if we went the remove mozunit route, we'd have to block on bug 1395630.

Otherwise, I don't think there's any reason not to add a setup.py.
Flags: needinfo?(ahalberstadt)
Assignee: nobody → dave.hunt
Status: NEW → ASSIGNED
Product: Core → Firefox Build System
Comment on attachment 8963270 [details]
Bug 1438250 - Make mozunit pip installable;

https://reviewboard.mozilla.org/r/232164/#review237660

This breaks |mach python-test| because `mozunit` is no longer on the python path. I think you just need to add `config/mozunit` to `build/virtualenv_packages.txt`.

::: config/mozunit/mozunit/mozunit.py:1
(Diff revision 1)
> +# This Source Code Form is subject to the terms of the Mozilla Public

I can't tell from this diff, but please make sure this was moved with `hg mv` to preserve history (drop this issue if it was).

::: config/mozunit/setup.py:1
(Diff revision 1)
> +# This Source Code Form is subject to the terms of the Mozilla Public

Please also move the `mozunit` tests under `config/test` to this directory (and make sure they pass)
Attachment #8963270 - Flags: review?(ahalberstadt) → review-
Attachment #8963270 - Attachment is obsolete: true
Comment on attachment 8963566 [details]
Bug 1438250 - Make mozunit pip installable;

https://reviewboard.mozilla.org/r/232490/#review237912

Thanks, lgtm!
Attachment #8963566 - Flags: review?(ahalberstadt) → review+
Comment on attachment 8963566 [details]
Bug 1438250 - Make mozunit pip installable;

https://reviewboard.mozilla.org/r/232490/#review237922

::: commit-message-a4564:1
(Diff revision 1)
> +Bug 1438250 - Make mozunit pip installable; r?ahal

You'll need to also update this line:
https://searchfox.org/mozilla-central/source/taskcluster/ci/source-test/python.yml#19
Pushed by dhunt@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/c063db1cf370
Make mozunit pip installable; r=ahal
https://hg.mozilla.org/mozilla-central/rev/c063db1cf370
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla61
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: