mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-02-19 17:03:56 +08:00
* convert release notes from markdown to html
* fall back to previous behavior if utf8 decoding or markdown parsing throws
* make simple markdown parser to avoid needing a library
* add unit test
* move markdown parser to common. add unit test
use `markdown-it-py` instead of `markdown` dependency for test comparison since it's already in Pipfile.lock
* test (almost) all release notes and add some extra html encoding
* update lock
Co-authored-by: Willem Melching <willem.melching@gmail.com>
old-commit-hash: 1aebe6ff6e
27 lines
656 B
Python
Executable File
27 lines
656 B
Python
Executable File
#!/usr/bin/env python3
|
|
from markdown_it import MarkdownIt
|
|
import os
|
|
import unittest
|
|
|
|
from common.basedir import BASEDIR
|
|
from common.markdown import parse_markdown
|
|
|
|
|
|
class TestMarkdown(unittest.TestCase):
|
|
# validate that our simple markdown parser produces the same output as `markdown_it` from pip
|
|
def test_current_release_notes(self):
|
|
self.maxDiff = None
|
|
|
|
with open(os.path.join(BASEDIR, "RELEASES.md")) as f:
|
|
for r in f.read().split("\n\n"):
|
|
|
|
# No hyperlink support is ok
|
|
if '[' in r:
|
|
continue
|
|
|
|
self.assertEqual(MarkdownIt().render(r), parse_markdown(r))
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|