Skip PDF tests when wkhtmltopdf unavailable (fixes CI).

This commit is contained in:
russell@unturf.com 2026-03-10 11:22:01 -04:00
parent 46bdf3a217
commit 2061097e13
3 changed files with 15 additions and 1 deletions

View file

@ -119,7 +119,7 @@ With JS: dropdown/popover with format picker, async download.
- [x] Implement wiki edit permissions in Namespace (`can_wiki_edit()`) - [x] Implement wiki edit permissions in Namespace (`can_wiki_edit()`)
- [x] Store revisions on edit (`node.wiki_edit()`) - [x] Store revisions on edit (`node.wiki_edit()`)
- [x] Revision history API endpoint - [x] Revision history API endpoint
- [ ] Diff endpoint (deferred — future work) - [x] Diff endpoint (`GET /api/v1/revisions/{id}/diff/{other_id}`)
### Phase 4: Auto-generated themes ### Phase 4: Auto-generated themes
- [x] Per-namespace theme generation (light + dark) - [x] Per-namespace theme generation (light + dark)

View file

@ -1,8 +1,11 @@
"""Unit tests for remarkbox.lib.pandoc — pandoc subprocess wrapper.""" """Unit tests for remarkbox.lib.pandoc — pandoc subprocess wrapper."""
import shutil
import unittest import unittest
import subprocess import subprocess
import pytest
from remarkbox.lib.pandoc import ( from remarkbox.lib.pandoc import (
convert, convert,
node_tree_to_markdown, node_tree_to_markdown,
@ -63,6 +66,10 @@ class TestConvert(unittest.TestCase):
self.assertIsInstance(result, bytes) self.assertIsInstance(result, bytes)
self.assertGreater(len(result), 100) self.assertGreater(len(result), 100)
@pytest.mark.skipif(
shutil.which("wkhtmltopdf") is None,
reason="wkhtmltopdf not installed",
)
def test_markdown_to_pdf_returns_bytes(self): def test_markdown_to_pdf_returns_bytes(self):
result = convert("# Test\n\nContent.", "markdown", "pdf", title="Test") result = convert("# Test\n\nContent.", "markdown", "pdf", title="Test")
self.assertIsInstance(result, bytes) self.assertIsInstance(result, bytes)

View file

@ -4,10 +4,13 @@ Tests the export, multi-syntax, wiki mode, and theme APIs end-to-end
via webtest against the full Pyramid app. via webtest against the full Pyramid app.
""" """
import shutil
import transaction import transaction
import unittest import unittest
import webtest import webtest
import pytest
from remarkbox.models import ( from remarkbox.models import (
Node, Node,
get_tm_session, get_tm_session,
@ -142,6 +145,10 @@ class TestExportThread(UndiggFunctionalTests):
self.assertEqual(res.status_int, 200) self.assertEqual(res.status_int, 200)
self.assertIn(b"Test Thread", res.body) self.assertIn(b"Test Thread", res.body)
@pytest.mark.skipif(
shutil.which("wkhtmltopdf") is None,
reason="wkhtmltopdf not installed",
)
def test_export_thread_pdf(self): def test_export_thread_pdf(self):
node_id = self._create_thread() node_id = self._create_thread()
res = self.testapp.get( res = self.testapp.get(