| 
13 | 13 | 
 
  | 
14 | 14 | ROOT_PATH = Path(__file__).parent.parent  | 
15 | 15 | CHANGELOG = ROOT_PATH / "docs" / "changelog.rst"  | 
16 |  | -README = ROOT_PATH / "README.md"  | 
 | 16 | +USAGE = ROOT_PATH / "docs" / "usage.rst"  | 
17 | 17 | INIT_FILE = ROOT_PATH / "flake8_async" / "__init__.py"  | 
18 | 18 | 
 
  | 
19 | 19 | ALLOW_FUTURE = "--allow-future-in-changelog" in sys.argv  | 
@@ -66,9 +66,12 @@ def get_releases() -> Iterable[Version]:  | 
66 | 66 | 
 
  | 
67 | 67 | 
 
  | 
68 | 68 | 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 | +    """  | 
70 | 73 |     latest_release = next(iter(get_releases()))  | 
71 |  | -    assert latest_release == VERSION  | 
 | 74 | +    assert latest_release >= VERSION, f"{latest_release}, {VERSION}"  | 
72 | 75 | 
 
  | 
73 | 76 | 
 
  | 
74 | 77 | def test_version_increments_are_correct() -> None:  | 
@@ -104,17 +107,21 @@ def update_version() -> None:  | 
104 | 107 |         INIT_FILE = ROOT_PATH / "flake8_async" / "__init__.py"  | 
105 | 108 |         subs = (f'__version__ = "{VERSION}"', f'__version__ = "{last_version}"')  | 
106 | 109 |         INIT_FILE.write_text(INIT_FILE.read_text().replace(*subs))  | 
 | 110 | +        print("updated VERSION in __init__.py")  | 
107 | 111 | 
 
  | 
108 | 112 |     # Similarly, update the pre-commit config example in the README  | 
109 |  | -    current = README.read_text()  | 
 | 113 | +    current = USAGE.read_text()  | 
110 | 114 |     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}",  | 
113 | 117 |         string=current,  | 
114 | 118 |         flags=re.MULTILINE,  | 
115 | 119 |     )  | 
 | 120 | +    if last_version != VERSION:  | 
 | 121 | +        assert current != wanted, "version changed but regex didn't substitute"  | 
116 | 122 |     if current != wanted:  | 
117 |  | -        README.write_text(wanted)  | 
 | 123 | +        USAGE.write_text(wanted)  | 
 | 124 | +        print("updated rev in pre-commit example")  | 
118 | 125 | 
 
  | 
119 | 126 | 
 
  | 
120 | 127 | if __name__ == "__main__":  | 
 | 
0 commit comments