Use portable PDF text extraction in localisation tests
Reportist CI Both renderer plugin suites passed.
Beffroi/reportist/pipeline/head This commit looks good
Details
Reportist CI Both renderer plugin suites passed.
Beffroi/reportist/pipeline/head This commit looks good
Details
This commit is contained in:
parent
9ee41254ed
commit
eb4dc9b2b5
|
|
@ -1,6 +1,7 @@
|
|||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
cd "$(dirname "${BASH_SOURCE[0]}")/.."
|
||||
python3 -m unittest discover -s tests -p 'test_plugin.py' -v
|
||||
uv run --isolated --no-project --with pypdf==6.7.5 \
|
||||
python3 -m unittest discover -s tests -p 'test_plugin.py' -v
|
||||
python3 -m unittest discover -s plugins/consumables/tests -p 'test_plugin.py' -v
|
||||
plugins/diagnostics/tests/test.sh
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@ import subprocess
|
|||
import tempfile
|
||||
import unittest
|
||||
|
||||
from pypdf import PdfReader
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
|
||||
|
||||
|
|
@ -14,7 +16,8 @@ class ReportPluginTests(unittest.TestCase):
|
|||
result = subprocess.run([str(root / 'build.sh'), 'render', 'report', str(source),
|
||||
'--output', str(output), '--force'], text=True, capture_output=True)
|
||||
self.assertEqual(result.returncode, 0, result.stderr)
|
||||
return subprocess.check_output(['pdftotext', '-layout', str(output), '-'], text=True)
|
||||
reader = PdfReader(output)
|
||||
return '\n'.join(page.extract_text(extraction_mode='layout') for page in reader.pages)
|
||||
|
||||
def test_localised_report_headings_and_authored_content(self):
|
||||
report = json.loads((ROOT / 'examples/example-report.json').read_text())
|
||||
|
|
|
|||
Loading…
Reference in New Issue