-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add |wpt| command frontend #6237
Conversation
Not quite done yet (missing docs), but should work in the current state. |
One apparent bug, and yes, docs are welcome. Realizing this may be a bit of a naive question: Why this approach and not something like Reviewed 11 of 11 files at r1. tools/lint/lint.py, line 768 at r1 (raw file):
Looks like this should be Comments from Reviewable |
AFAIK if you create a setup.py then the user has to create their own virtualenv and run python setup.py install &c. Making it possible to run everything from a single command without any setup apart from cloning the repo is very desirable (we could consider adding a command to install the virtualenv tool as well, for example). This approach is based heavily — in spirit if not im implementation — on Mozilla's |
Firefox (nightly)Testing web-platform-tests at revision 6967685 |
Sauce (safari)Testing web-platform-tests at revision 6967685 |
Chrome (unstable)Testing web-platform-tests at revision 6967685 |
Sauce (MicrosoftEdge)Testing web-platform-tests at revision 6967685 |
Happy to see further consolidation happening. This patch omits at least three files: |
README.md
Outdated
|
||
* `wpt run` - For running tests in a browser | ||
* `wpt lint` - For running the lint against all tests | ||
* `wpt manifest` - For updating or generating a `MANIFEST.json` test manifest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you intentionally omit install-browser
?
|
||
if __name__ == '__main__': | ||
args = parser.parse_args() | ||
run(None, **vars(args)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the new wpt
utility exposing the functionality from a more unified
interface, I can't think of a reason to maintain this module as an executable.
What do you say we remove this and update ci_unittest.sh
to use wpt
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see that you've updated ci_unittest.sh
, but this script is still executable. Do you have a use case in mind for executing this file directly?
tools/wpt/wpt.py
Outdated
parser.add_argument("--venv", action="store", help="Path to an existing virtualenv to use") | ||
parser.add_argument("--debug", action="store_true", help="Run the debugger in case of an exception") | ||
subparsers = parser.add_subparsers(dest="command") | ||
for command, props in commands.iteritems(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other parts of WPT's infrastructure are tested in Python 3; are you interested
in supporting that platform with the wpt
utility? I'm not the best choice for
reviewing for Python 3 compatibility concerns, but I could try (e.g.
iteritems
isn't available there). If not, I'll refrain from pointing out
incompatibilities.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shrug. I guess I ought to make this work with Python 3, but wptrunner doesn't, for example, so it won't be super useful.
tools/wpt/run.py
Outdated
@@ -1,3 +1,4 @@ | |||
# wpt command:run:main |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm having trouble understanding the purpose of this comment. Is it a vestige of some previous implementation strategy? Or am I missing something about the current patch?
tools/manifest/update.py
Outdated
|
||
update_from_cli(**vars(opts)) | ||
print run |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Errant print
statement
tools/browserutils/commands.json
Outdated
@@ -0,0 +1,2 @@ | |||
{"install-browser": {"path": "install.py", "script": "run", "parser": "get_parser", "help": "Install browser components", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wpt install-browser firefox browser
looks a bit redundant, while wpt install-browser firefox webdriver
is a little misleading. What do you think
about calling this sub-command install
instead?
tools/wpt/run.py
Outdated
@@ -295,10 +310,7 @@ def main(): | |||
venv.install_requirements(os.path.join(wpt_root, "tools", "wptrunner", "requirements.txt")) | |||
venv.install("requests") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this still necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not necessary, but it allows the file to be run directly from the command line, which seems somewhat useful to keep for now.
@@ -0,0 +1,2 @@ | |||
{"run": {"path": "run.py", "script": "run", "parser": "create_parser", "help": "Run tests in a browser", | |||
"virtualenv": true, "install": ["requests"], "requirements": ["../wptrunner/requirements.txt"]}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the "requests" module is necessary to use the wptrunner
module, why isn't it listed in wptrunner/requirements.txt
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's necessary to install the browser/webdriver/prefs/etc. so it's a requirement for wpt run
but not for wptrunner itself.
b78831b
to
c2c13cd
Compare
40ef52c
to
7aa63c8
Compare
5ded5b9
to
00a0fcd
Compare
This is ready and waiting for review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The README.md
file contains a few lingering references to wptrun
: wptrun --help
, wptrun --wptrunner-help
wptrun --binary=path product
(I don't think this last one is supported by wpt
, though).
The lint.whitelist
file includes a reference to the wptrun.py
file that this patch renames. The tests pass, so I guess this can be removed (rather than updated).
Would you mind removing the wptrun,
lintand
whitelist` executables from the top level of the project?
|
||
if __name__ == '__main__': | ||
args = parser.parse_args() | ||
run(None, **vars(args)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see that you've updated ci_unittest.sh
, but this script is still executable. Do you have a use case in mind for executing this file directly?
tools/wpt/run.py
Outdated
@@ -7,11 +7,14 @@ | |||
import tarfile | |||
from distutils.spawn import find_executable | |||
|
|||
wpt_root = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I recommend os.pardir
for consistency with the change to tools/manifest/update.py
.
tools/wpt/wpt.py
Outdated
|
||
|
||
here = os.path.dirname(__file__) | ||
wpt_root = os.path.abspath(os.path.join(here, "..", "..")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment regarding os.pardir
I want to leave the executables for now in case downstream consumers are making use of them in scripts or integrations. They can be removed in a followup once this has been announced. |
@jugglinmike updated this. |
Got it. This latest version is rebased on |
A couple of the documented options for the Specifying
Specifying
...although I receive similar errors when using |
This is intended to provide a single point of entry for all wpt commands and make it easier to share infrastructure like virtual environments. Commands are defined via a commands.json file in the directory containing the command. This isi still pretty rough, but it basically works.
There's a lot of new untested code here, especially given @jugglinmike found issues earlier. :/ |
The command
|
Closing this in favour of #6421 that ended up fixing some issues here. |
This change is