testing/web-platform/tests/wpt.py
author Stephen McGruer <smcgruer@chromium.org>
Tue, 28 Apr 2020 11:30:48 +0000
changeset 527491 acd8dbb537706a27f4a0f3173b1a9cae2a4a5562
parent 527386 8b5cece2146ada48cd701b167f56852d78a0cf50
permissions -rw-r--r--
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

# This file exists to allow `python wpt <command>` to work on Windows:
# 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'))