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 a wptrun frontend to wptrunner. #5893
Conversation
Firefox (nightly)Testing web-platform-tests at revision aa06e88 |
Chrome (unstable)Testing web-platform-tests at revision aa06e88 |
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 happy to see this developing; it's going to help a lot of people. I've tested it locally, and it seems to work as intended. Could we document its presence in the README.md
file and including installation instructions?
tools/browserutils/browser.py
Outdated
}.get(uname[0]) | ||
|
||
if platform is None: | ||
raise ValueError("Unable to construct a valid Firefox package name for current platform") |
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.
Typo: "Firefox package" -> "GeckoDriver package"
wptrun.py
Outdated
@@ -0,0 +1,260 @@ | |||
import argparse |
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.
Think this file can go in tools/
? The top-level is already plenty cluttered, but I'd still like to avoid adding more when possible.
wptrun.py
Outdated
return True | ||
while True: | ||
resp = raw_input("Download and install %s [Y/n]? " % component).strip().lower() | ||
if not resp or resp == "y": |
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'd rather interpret "empty response" as invalid, not "yes".
wptrun.py
Outdated
hosts_path = "/etc/hosts" | ||
else: | ||
hosts_path = "C:\Windows\System32\drivers\etc\hosts" | ||
with open(hosts_path) as f: |
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.
In case you missed it, the lint script is complaining about this line:
wptrun.py:79: File opened without providing an explicit mode (note: binary files must be read with 'b' in the mode flags) (OPEN-NO-MODE)
return "%s%s" % (platform, bits) | ||
|
||
def install(self): | ||
return None |
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 know we don't invoke this method today, but it seems like for the time being, we'd want to inherit the base class's implementation.
tools/browserutils/browser.py
Outdated
url = "http://chromedriver.storage.googleapis.com/%s/chromedriver_%s.zip" % (latest, | ||
self.platform_string()) | ||
unzip(get(url).raw, dest) | ||
path = os.path.join(dest, 'chromedriver') |
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.
Typo: single quotes
tools/browserutils/virtualenv.py
Outdated
return path | ||
|
||
def activate(self): | ||
path = os.path.join(self.bin_path, 'activate_this.py') |
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.
Typo: single quotes
@@ -14,3 +14,4 @@ webdriver/.idea | |||
.vscode/ | |||
.DS_Store | |||
*.rej | |||
_venv |
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.
Missing new line at the EOF
Review status: 0 of 10 files reviewed at latest revision, 8 unresolved discussions, some commit checks failed. wptrun.py, line 95 at r1 (raw file): Previously, jugglinmike wrote…
I quite strongly disagree. There's a long history of tools using empty response to mean "do whatever the sensible default is" e.g. apt. tools/browserutils/browser.py, line 227 at r1 (raw file): Previously, jugglinmike wrote…
That doesn't work because the base class implementation is marked as abstract. Comments from Reviewable |
Reviewed 5 of 11 files at r1, 6 of 6 files at r2. tools/wptrun.py, line 95 at r1 (raw file):
Comments from Reviewable |
Review status: all files reviewed at latest revision, 8 unresolved discussions, some commit checks failed. Comments from Reviewable |
This provides a convenient way for users to run tests in a browser without having to grasp the many command line switches of wptrunner, or install dependencies by hand. The syntax is basically wptrun browser [tests] e.g. wptrun firefox dom/historical.html Currently this is implemented for Firefox and Chrome, and will not download the actual browser binary for you. For Firefox downloading certutil is also a problem because there aren't convenient binary releases. However we can still download the appropriate webdriver implementations, firefox prefs, create a virtualenv, install required wptrunner dependencies for the browser and generally make the process of running tests substantially easier. The keen-eyed with notice that this stole a lot of code from the stability checker. The intent in the long term is cearly to re-merge these codepaths so that we have a single implementation here.
Reviewed 1 of 6 files at r2, 3 of 3 files at r3. README.md, line 77 at r3 (raw file):
This is no longer in the root of the checkout, but in the README.md, line 93 at r3 (raw file):
TYPOs: "dependencies", "particular" Comments from Reviewable |
import re | ||
import stat | ||
from abc import ABCMeta, abstractmethod | ||
from configparser import RawConfigParser |
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.
configparser is 3.x while ConfigParser is 2.x noting that the web-platform-tests documentation states that "test environment requires Python 2.7+".
def create(self): | ||
if os.path.exists(self.path): | ||
shutil.rmtree(self.path) | ||
call(self.virtualenv, "--no-download", self.path) |
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 --no-download
option was removed in pip version 7.0.0.
This isn't called from anywhere. The DBUS_SESSION_BUS_ADDRESS bits were added in #5893 but was unused even then. Since then it's been copied around a lot.
This isn't called from anywhere. The DBUS_SESSION_BUS_ADDRESS bits were added in #5893 but was unused even then. Since then it's been copied around a lot.
This isn't called from anywhere. The DBUS_SESSION_BUS_ADDRESS bits were added in #5893 but was unused even then. Since then it's been copied around a lot.
…rowser.py, a=testonly Automatic update from web-platform-testsRemove dead code prepare_environment in browser.py (#9653) This isn't called from anywhere. The DBUS_SESSION_BUS_ADDRESS bits were added in web-platform-tests/wpt#5893 but was unused even then. Since then it's been copied around a lot. wpt-commits: c58e51bef6e114539375fa89e094b20c2056ebe9 wpt-pr: 9653 wpt-commits: c58e51bef6e114539375fa89e094b20c2056ebe9 wpt-pr: 9653
…rowser.py, a=testonly Automatic update from web-platform-testsRemove dead code prepare_environment in browser.py (#9653) This isn't called from anywhere. The DBUS_SESSION_BUS_ADDRESS bits were added in web-platform-tests/wpt#5893 but was unused even then. Since then it's been copied around a lot. wpt-commits: c58e51bef6e114539375fa89e094b20c2056ebe9 wpt-pr: 9653 wpt-commits: c58e51bef6e114539375fa89e094b20c2056ebe9 wpt-pr: 9653 UltraBlame original commit: 15aacce348c225e44a048048176449e24868b09e
…rowser.py, a=testonly Automatic update from web-platform-testsRemove dead code prepare_environment in browser.py (#9653) This isn't called from anywhere. The DBUS_SESSION_BUS_ADDRESS bits were added in web-platform-tests/wpt#5893 but was unused even then. Since then it's been copied around a lot. wpt-commits: c58e51bef6e114539375fa89e094b20c2056ebe9 wpt-pr: 9653 wpt-commits: c58e51bef6e114539375fa89e094b20c2056ebe9 wpt-pr: 9653 UltraBlame original commit: 15aacce348c225e44a048048176449e24868b09e
…rowser.py, a=testonly Automatic update from web-platform-testsRemove dead code prepare_environment in browser.py (#9653) This isn't called from anywhere. The DBUS_SESSION_BUS_ADDRESS bits were added in web-platform-tests/wpt#5893 but was unused even then. Since then it's been copied around a lot. wpt-commits: c58e51bef6e114539375fa89e094b20c2056ebe9 wpt-pr: 9653 wpt-commits: c58e51bef6e114539375fa89e094b20c2056ebe9 wpt-pr: 9653 UltraBlame original commit: 15aacce348c225e44a048048176449e24868b09e
This provides a convenient way for users to run tests in a browser
without having to grasp the many command line switches of wptrunner,
or install dependencies by hand. The syntax is basically
wptrun browser [tests]
e.g.
wptrun firefox dom/historical.html
Currently this is implemented for Firefox and Chrome, and will not
download the actual browser binary for you. For Firefox downloading
certutil is also a problem because there aren't convenient binary
releases. However we can still download the appropriate webdriver
implementations, firefox prefs, create a virtualenv, install required
wptrunner dependencies for the browser and generally make the process
of running tests substantially easier.
The keen-eyed with notice that this stole a lot of code from the
stability checker. The intent in the long term is cearly to re-merge
these codepaths so that we have a single implementation here.
This change is