1
0
mirror of https://github.com/venthur/blag.git synced 2025-11-25 20:52:43 +00:00
This commit is contained in:
Bastian Venthur
2024-07-01 13:47:57 +02:00
parent e631b17fb1
commit 5943dab690

View File

@@ -1,11 +1,14 @@
"""Test markdown module.""" """Test markdown module."""
from datetime import datetime from datetime import datetime
import os
from typing import Any from typing import Any
import markdown import markdown
import pytest import pytest
import blag
from blag.blag import build
from blag.markdown import convert_markdown, markdown_factory from blag.markdown import convert_markdown, markdown_factory
@@ -111,3 +114,28 @@ this --- is -- a test ...
assert "mdash" not in html assert "mdash" not in html
assert "ndash" not in html assert "ndash" not in html
assert "hellip" not in html assert "hellip" not in html
def test_performance(args) -> None:
# create 1000 random markdown files in the content directory
with open(os.path.join(blag.__path__[0], "content", "testpage.md")) as fh:
markdown = fh.read()
for i in range(1000):
with open(f"content/{i}.md", "w") as f:
f.write(markdown)
from time import time
t = time()
build(args)
print(time() - t)
import cProfile
t = time()
cProfile.run("build(args)")
#build(args)
print(time() - t)
1 / 0