Skip to content

Commit 25010ac

Browse files
committed
allow larger release in changelog, fix update_version
1 parent dca068a commit 25010ac

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

docs/usage.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ adding the following to your ``.pre-commit-config.yaml``:
3333
minimum_pre_commit_version: '2.9.0'
3434
repos:
3535
- repo: https://github.com/python-trio/flake8-async
36-
rev: 23.2.5
36+
rev: 24.10.2
3737
hooks:
3838
- id: flake8-async
3939
# args: [--enable=ASYNC, --disable=ASYNC9, --autofix=ASYNC]

tests/check_changelog_and_version.py

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
ROOT_PATH = Path(__file__).parent.parent
1515
CHANGELOG = ROOT_PATH / "docs" / "changelog.rst"
16-
README = ROOT_PATH / "README.md"
16+
USAGE = ROOT_PATH / "docs" / "usage.rst"
1717
INIT_FILE = ROOT_PATH / "flake8_async" / "__init__.py"
1818

1919
ALLOW_FUTURE = "--allow-future-in-changelog" in sys.argv
@@ -66,9 +66,12 @@ def get_releases() -> Iterable[Version]:
6666

6767

6868
def test_last_release_against_changelog() -> None:
69-
"""Ensure we have the latest version covered in 'changelog.rst'."""
69+
"""Ensure we have the latest version covered in 'changelog.rst'.
70+
71+
If changelog version is greater, the __init__ gets bumped in update_version().
72+
"""
7073
latest_release = next(iter(get_releases()))
71-
assert latest_release == VERSION
74+
assert latest_release >= VERSION, f"{latest_release}, {VERSION}"
7275

7376

7477
def test_version_increments_are_correct() -> None:
@@ -104,17 +107,21 @@ def update_version() -> None:
104107
INIT_FILE = ROOT_PATH / "flake8_async" / "__init__.py"
105108
subs = (f'__version__ = "{VERSION}"', f'__version__ = "{last_version}"')
106109
INIT_FILE.write_text(INIT_FILE.read_text().replace(*subs))
110+
print("updated VERSION in __init__.py")
107111

108112
# Similarly, update the pre-commit config example in the README
109-
current = README.read_text()
113+
current = USAGE.read_text()
110114
wanted = re.sub(
111-
pattern=r"^ rev: (\d+\.\d+\.\d+)$",
112-
repl=f" rev: {last_version}",
115+
pattern=r"^ rev: (\d+\.\d+\.\d+)$",
116+
repl=f" rev: {last_version}",
113117
string=current,
114118
flags=re.MULTILINE,
115119
)
120+
if last_version != VERSION:
121+
assert current != wanted, "version changed but regex didn't substitute"
116122
if current != wanted:
117-
README.write_text(wanted)
123+
USAGE.write_text(wanted)
124+
print("updated rev in pre-commit example")
118125

119126

120127
if __name__ == "__main__":

0 commit comments

Comments
 (0)