gecko-dev/testing/web-platform/tests/wpt.py
Stephen McGruer 5f793ef2b0 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
2020-04-28 11:30:48 +00:00

8 lines
321 B
Python

# 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'))