import calendar
import datetime
import pathlib
+import subprocess
+
from lxml import (
etree,
html,
root.insert(index, header)
tree.write(p.as_posix(), method='html', pretty_print=True)
+ subprocess.run(['git', 'add', p])
def update_release_notes(previous_version: str) -> None:
ul.insert(0, li)
tree.write(p.as_posix(), method='html', pretty_print=True)
+ subprocess.run(['git', 'add', p])
def update_calendar(previous_version: str) -> None:
new.insert(0, td)
tree.write(p.as_posix(), method='html', pretty_print=True)
+ subprocess.run(['git', 'add', p])
def main() -> None:
update_index(is_point, args.version, previous_version)
update_release_notes(previous_version)
update_calendar(previous_version)
+ subprocess.run(['git', 'commit', '-m',
+ 'docs: update calendar, add news item, and link releases '
+ f'notes for {previous_version}'])
if __name__ == "__main__":
from . import post_version
+# Mock out subprocess.run to avoid having git commits
+@mock.patch('bin.post_version.subprocess.run', mock.Mock())
class TestUpdateCalendar:
HEAD = textwrap.dedent("""\