Closed Bug 1554762 Opened 5 years ago Closed 5 years ago

[wpt-sync] Sync PR 17033 - Improve error message when virtualenv is missing

Categories

(Testing :: web-platform-tests, defect, P4)

defect

Tracking

(firefox69 fixed)

RESOLVED FIXED
mozilla69
Tracking Status
firefox69 --- fixed

People

(Reporter: mozilla.org, Unassigned)

References

()

Details

(Whiteboard: [wptsync upstream])

Sync web-platform-tests PR 17033 into mozilla-central (this bug is closed when the sync is complete).

PR: https://github.com/web-platform-tests/wpt/pull/17033
Details from upstream follow.

Mike Pennisi <mike@mikepennisi.com> wrote:

Improve error message when virtualenv is missing

It can be challenging to properly configure systems to run the WPT CLI.
In recognition of this, this project maintains code paths that improve
error messages, helping users troubleshoot misconfigured systems.

Users may not have the virtualenv module installed, or they may have
it installed in such a way that is inaccessible during command-line
execution. Prior to the application of this patch, the error message
reported by the WPT CLI is somewhat cryptic:

 $ ./wpt run firefox
 Traceback (most recent call last):
   File "./wpt", line 4, in <module>
     from tools.wpt import wpt
   File "/home/vagrant/wpt/tools/wpt/wpt.py", line 10, in <module>
     from . import virtualenv
   File "/home/vagrant/wpt/tools/wpt/virtualenv.py", line 7, in <module>
     import pkg_resources
 ImportError: No module named pkg_resources

With this patch applied, a more helpful error is produced by a branch
which was previously created for this purpose:

 $ ./wpt run firefox
 Traceback (most recent call last):
   File "./wpt", line 5, in <module>
     wpt.main()
   File "/home/vagrant/wpt/tools/wpt/wpt.py", line 143, in main
     venv = setup_virtualenv(main_args.venv, main_args.skip_venv_setup, props)
   File "/home/vagrant/wpt/tools/wpt/wpt.py", line 117, in setup_virtualenv
     venv = virtualenv.Virtualenv(path, should_skip_setup)
   File "/home/vagrant/wpt/tools/wpt/virtualenv.py", line 30, in __init__
     raise ValueError("virtualenv must be installed and on the PATH")
 ValueError: virtualenv must be installed and on the PATH

Some commands do not rely on virtualenv, e.g. wpt lint. This change
also makes it possible to execute those commands when virtualenv is
not available.

The PR was not expected to affect any tests, but the try push wasn't a success. Check the try results for infrastructure issues
The PR was not expected to affect any tests, but the try push wasn't a success. Check the try results for infrastructure issues
The PR was not expected to affect any tests, but the try push wasn't a success. Check the try results for infrastructure issues
The PR was not expected to affect any tests, but the try push wasn't a success. Check the try results for infrastructure issues
Pushed by james@hoppipolla.co.uk:
https://hg.mozilla.org/integration/mozilla-inbound/rev/bc296c60b6a0
[wpt PR 17033] - Improve error message when virtualenv is missing, a=testonly
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla69
Whiteboard: [wptsync downstream] → [wptsync upstream]
You need to log in before you can comment on or make changes to this bug.