Skip to content

Commit 022df2d

Browse files
committed
Fix autoupdate tools for new tox
1 parent abff9f2 commit 022df2d

File tree

4 files changed

+22
-11
lines changed

4 files changed

+22
-11
lines changed

hypothesis-python/tox.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ toxworkdir={env:TOX_WORK_DIR:.tox}
55
[testenv]
66
deps =
77
-r../requirements/test.txt
8-
whitelist_externals=
8+
allowlist_externals =
99
bash
1010
passenv=
1111
HOME
@@ -141,7 +141,7 @@ commands=
141141
[testenv:coverage]
142142
deps =
143143
-r../requirements/coverage.txt
144-
whitelist_externals=
144+
allowlist_externals =
145145
rm
146146
setenv=
147147
PYTHONDEVMODE=1

tooling/src/hypothesistooling/__main__.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -330,16 +330,9 @@ def upgrade_requirements():
330330
compile_requirements(upgrade=True)
331331
subprocess.call(["./build.sh", "format"], cwd=tools.ROOT) # exits 1 if changed
332332
if has_diff(hp.PYTHON_SRC) and not os.path.isfile(hp.RELEASE_FILE):
333-
if has_diff(f"{hp.PYTHON_SRC}/hypothesis/vendor/tlds-alpha-by-domain.txt"):
334-
msg = (
335-
"our vendored `list of top-level domains "
336-
"<https://www.iana.org/domains/root/db>`__,\nwhich is used by the "
337-
"provisional :func:`~hypothesis.provisional.domains` strategy."
338-
)
339-
else:
340-
msg = "our autoformatting tools, improving our code style without any API changes."
333+
msg = hp.get_autoupdate_message(domainlist_changed=has_diff(hp.DOMAINS_LIST))
341334
with open(hp.RELEASE_FILE, mode="w") as f:
342-
f.write(f"RELEASE_TYPE: patch\n\nThis patch updates {msg}\n")
335+
f.write(f"RELEASE_TYPE: patch\n\n" + msg)
343336
update_python_versions()
344337
subprocess.call(["git", "add", "."], cwd=tools.ROOT)
345338

tooling/src/hypothesistooling/projects/hypothesispython.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@
2929

3030
PYTHON_SRC = os.path.join(HYPOTHESIS_PYTHON, "src")
3131
PYTHON_TESTS = os.path.join(HYPOTHESIS_PYTHON, "tests")
32+
DOMAINS_LIST = os.path.join(
33+
PYTHON_SRC, "hypothesis", "vendor", "tlds-alpha-by-domain.txt"
34+
)
3235

3336
RELEASE_FILE = os.path.join(HYPOTHESIS_PYTHON, "RELEASE.rst")
3437

@@ -234,3 +237,16 @@ def latest_version():
234237

235238
def tag_name():
236239
return PYTHON_TAG_PREFIX + __version__
240+
241+
242+
def get_autoupdate_message(domainlist_changed: bool) -> str:
243+
if domainlist_changed:
244+
return (
245+
"This patch updates our vendored `list of top-level domains "
246+
"<https://www.iana.org/domains/root/db>`__,\nwhich is used by the "
247+
"provisional :func:`~hypothesis.provisional.domains` strategy.\n"
248+
)
249+
return (
250+
"This patch updates our autoformatting tools, "
251+
"improving our code style without any API changes."
252+
)

whole-repo-tests/test_release_files.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ def test_release_file_exists_and_is_valid(project):
2929
def test_release_file_has_no_merge_conflicts():
3030
_, message = rm.parse_release_file(hp.RELEASE_FILE)
3131
assert "<<<" not in message, "Merge conflict in RELEASE.rst"
32+
if message in {hp.get_autoupdate_message(x).strip() for x in (True, False)}:
33+
return
3234
_, *recent_changes, _ = hp.CHANGELOG_ANCHOR.split(hp.changelog(), maxsplit=12)
3335
for entry in recent_changes:
3436
_, version, old_msg = (x.strip() for x in hp.CHANGELOG_BORDER.split(entry))

0 commit comments

Comments
 (0)