This commit is contained in:
Bastian Venthur
2024-07-08 15:35:58 +02:00
parent 5943dab690
commit c4f3c09730
2 changed files with 4 additions and 28 deletions

View File

@@ -65,6 +65,10 @@ serve-docs: $(VENV)
manpage: $(VENV) manpage: $(VENV)
help2man $(BIN)/blag --no-info -n "blog-aware, static site generator" -o debian/blag.1 help2man $(BIN)/blag --no-info -n "blog-aware, static site generator" -o debian/blag.1
.PHONY: benchmark
benchmark: $(VENV)
$(BIN)/pytest --no-cov -rP tests/benchmark.py
.PHONY: clean .PHONY: clean
clean: clean:
rm -rf build dist *.egg-info rm -rf build dist *.egg-info

View File

@@ -1,14 +1,11 @@
"""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
@@ -114,28 +111,3 @@ 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