Bug 1631279 [wpt PR 23096] - Allow wpt.py to be called from outside the WPT directory, a=testonly
authorStephen McGruer <smcgruer@chromium.org>
Tue, 28 Apr 2020 11:30:48 +0000
changeset 527491 acd8dbb537706a27f4a0f3173b1a9cae2a4a5562
parent 527490 bcfa61b269a14bdcc96cf6349a710e8716bf123c
child 527492 a02d13b89367b57786f6ec87cff1679a41a4bb70
push id37368
push userbtara@mozilla.com
push dateFri, 01 May 2020 21:45:51 +0000
treeherdermozilla-central@0f9c5a59e45d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1631279, 23096, 23095
milestone77.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1631279 [wpt PR 23096] - Allow wpt.py to be called from outside the WPT directory, a=testonly Automatic update from web-platform-tests Allow wpt.py to be called from outside the WPT directory Note that this is about wpt.py, which is a file specifically used for Windows, and not 'wpt' which is the main entry-point file. Previously wpt.py would just try to exec 'wpt' in the current working directory, which may not be the directory that contains 'wpt.py' (and thus, no 'wpt'!). To fix that, we os.chdir into the same directory as the __file__. Fixes https://github.com/web-platform-tests/wpt/issues/23095 -- wpt-commits: 07ca316106218e6c21133fed91176d8e41df1d17 wpt-pr: 23096
testing/web-platform/tests/wpt.py
--- a/testing/web-platform/tests/wpt.py
+++ b/testing/web-platform/tests/wpt.py
@@ -1,3 +1,7 @@
 # This file exists to allow `python wpt <command>` to work on Windows:
-# https://github.com/web-platform-tests/wpt/pull/6907
+# https://github.com/web-platform-tests/wpt/pull/6907 and
+# https://github.com/web-platform-tests/wpt/issues/23095
+import os
+abspath = os.path.abspath(__file__)
+os.chdir(os.path.dirname(abspath))
 exec(compile(open("wpt", "r").read(), "wpt", 'exec'))