Skip to content

Commit ccfa051

Browse files
committed
Improve how test data is updated and remove an unnecessary URL request
1 parent 73063bd commit ccfa051

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

tests/test_lib.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,17 @@
11
import json
22
import pathlib
3-
import urllib.request
43

54
import pytest
65
from urlpattern import URLPattern
76

7+
# This test is based on the web-platform-tests Project.
8+
#
89
# To update the test data:
910
#
10-
# 1. Remove tests/urlpatterntestdata.json.
11-
# 2. Update the URL.
12-
# 2. Run `pytest`.
11+
# 1. Go to https://github.com/web-platform-tests/wpt/blob/master/urlpattern/resources/urlpatterntestdata.json.
12+
# 2. Copy the content.
13+
# 3. Paste into `tests/urlpatterntestdata.json`.
1314
urlpatterntestdata_path = pathlib.Path("tests/urlpatterntestdata.json")
14-
if not urlpatterntestdata_path.exists():
15-
with urllib.request.urlopen(
16-
"https://raw.githubusercontent.com/web-platform-tests/wpt/3ce3e9794fcd97ff24506f5c5325f91fc00ef79c/urlpattern/resources/urlpatterntestdata.json"
17-
) as f:
18-
urlpatterntestdata_path.write_bytes(f.read())
1915
urlpatterntestdata = json.loads(urlpatterntestdata_path.read_text("utf-8"))
2016

2117

0 commit comments

Comments
 (0)