Add an assertion to check the version got modified

This commit is contained in:
Paul Moore 2020-01-15 09:10:27 +00:00
parent 9dff8c1440
commit 53eba71ef4
1 changed files with 6 additions and 0 deletions

View File

@ -88,13 +88,19 @@ def generate_news(session: Session, version: str) -> None:
def update_version_file(version: str, filepath: str) -> None:
with open(filepath, "r", encoding="utf-8") as f:
content = list(f)
file_modified = False
with open(filepath, "w", encoding="utf-8") as f:
for line in content:
if line.startswith("__version__ ="):
f.write('__version__ = "{}"\n'.format(version))
file_modified = True
else:
f.write(line)
assert file_modified, \
"Version file {} did not get modified".format(filepath)
def create_git_tag(session: Session, tag_name: str, *, message: str) -> None:
session.run(